Skip to content

Commit

Permalink
fix: be completely independent from typescript (#1433)
Browse files Browse the repository at this point in the history
Or: to resolve typescript module correctly.

The current code still has a "hard" top-level requiring for typescript, which may cause issues when installing ts-node globally and installing typescript locally (i.e. you have to install them both globally or both locally). Since we've already resolving typescript smartly in the code using `loadCompiler`, why not resolving `ScriptTarget` from the resolved one?
  • Loading branch information
Songkeys committed Aug 18, 2021
1 parent 385a469 commit 9a14af7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/index.ts
Expand Up @@ -23,7 +23,6 @@ import {
ModuleTypeClassifier,
} from './module-type-classifier';
import { createResolverFunctions } from './resolver-functions';
import { ScriptTarget } from 'typescript';

export { TSCommon };
export {
Expand Down Expand Up @@ -551,7 +550,7 @@ export function create(rawOptions: CreateOptions = {}): Service {
];

// Experimental REPL await is not compatible targets lower than ES2018
const targetSupportsTla = config.options.target! >= ScriptTarget.ES2018;
const targetSupportsTla = config.options.target! >= ts.ScriptTarget.ES2018;
if (options.experimentalReplAwait === true && !targetSupportsTla) {
throw new Error(
'Experimental REPL await is not compatible with targets lower than ES2018'
Expand Down

0 comments on commit 9a14af7

Please sign in to comment.