(moduleName: string)
| 26 | * @returns |
| 27 | */ |
| 28 | export function requireOverride(moduleName: string) { |
| 29 | const TSSERVER = 'typescript/lib/tsserverlibrary'; |
| 30 | if (moduleName === 'typescript') { |
| 31 | throw new Error(`Import '${TSSERVER}' instead of 'typescript'`); |
| 32 | } |
| 33 | if (moduleName === TSSERVER) { |
| 34 | const {tsProbeLocations, tsdk} = parseCommandLine(process.argv); |
| 35 | moduleName = resolveTsServer(tsProbeLocations, tsdk).resolvedPath; |
| 36 | } |
| 37 | return originalRequire(moduleName); |
| 38 | } |
| 39 | |
| 40 | requireOverride.resolve = originalRequire.resolve; |
nothing calls this directly
no test coverage detected