mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Show implied options in --showConfig (#56701)
This commit is contained in:
parent
96e7af47fd
commit
b436976bd3
14
package-lock.json
generated
14
package-lock.json
generated
@ -52,7 +52,7 @@
|
||||
"playwright": "^1.38.0",
|
||||
"source-map-support": "^0.5.21",
|
||||
"tslib": "^2.5.0",
|
||||
"typescript": "^5.3.2",
|
||||
"typescript": "5.4.0-dev.20231206",
|
||||
"which": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
@ -3786,9 +3786,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.3.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
|
||||
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||
"version": "5.4.0-dev.20231206",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.0-dev.20231206.tgz",
|
||||
"integrity": "sha512-bKJ5+3jwj4qTzNg7C97rCVLgyyYuzjYh/Pf0zlpOyyq9vpI3TVLO09d1gQ8jS5M+BSLONojTijei0KHmFoBezw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
@ -6584,9 +6584,9 @@
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "5.3.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
|
||||
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||
"version": "5.4.0-dev.20231206",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.0-dev.20231206.tgz",
|
||||
"integrity": "sha512-bKJ5+3jwj4qTzNg7C97rCVLgyyYuzjYh/Pf0zlpOyyq9vpI3TVLO09d1gQ8jS5M+BSLONojTijei0KHmFoBezw==",
|
||||
"dev": true
|
||||
},
|
||||
"typical": {
|
||||
|
||||
@ -78,7 +78,7 @@
|
||||
"playwright": "^1.38.0",
|
||||
"source-map-support": "^0.5.21",
|
||||
"tslib": "^2.5.0",
|
||||
"typescript": "^5.3.2",
|
||||
"typescript": "5.4.0-dev.20231206",
|
||||
"which": "^2.0.2"
|
||||
},
|
||||
"overrides": {
|
||||
|
||||
@ -15,6 +15,7 @@ import {
|
||||
CommandLineOptionOfListType,
|
||||
CompilerOptions,
|
||||
CompilerOptionsValue,
|
||||
computedOptions,
|
||||
ConfigFileSpecs,
|
||||
containsPath,
|
||||
convertToRelativePath,
|
||||
@ -103,6 +104,7 @@ import {
|
||||
removeTrailingDirectorySeparator,
|
||||
returnTrue,
|
||||
ScriptTarget,
|
||||
some,
|
||||
startsWith,
|
||||
StringLiteral,
|
||||
SyntaxKind,
|
||||
@ -2475,9 +2477,10 @@ export function convertToTSConfig(configParseResult: ParsedCommandLine, configFi
|
||||
),
|
||||
f => getRelativePathFromFile(getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), getNormalizedAbsolutePath(f, host.getCurrentDirectory()), getCanonicalFileName),
|
||||
);
|
||||
const optionMap = serializeCompilerOptions(configParseResult.options, { configFilePath: getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), useCaseSensitiveFileNames: host.useCaseSensitiveFileNames });
|
||||
const pathOptions = { configFilePath: getNormalizedAbsolutePath(configFileName, host.getCurrentDirectory()), useCaseSensitiveFileNames: host.useCaseSensitiveFileNames };
|
||||
const optionMap = serializeCompilerOptions(configParseResult.options, pathOptions);
|
||||
const watchOptionMap = configParseResult.watchOptions && serializeWatchOptions(configParseResult.watchOptions);
|
||||
const config = {
|
||||
const config: TSConfig & { watchOptions?: object; } = {
|
||||
compilerOptions: {
|
||||
...optionMapToObject(optionMap),
|
||||
showConfig: undefined,
|
||||
@ -2500,6 +2503,19 @@ export function convertToTSConfig(configParseResult: ParsedCommandLine, configFi
|
||||
} : {}),
|
||||
compileOnSave: !!configParseResult.compileOnSave ? true : undefined,
|
||||
};
|
||||
|
||||
const providedKeys = new Set(optionMap.keys());
|
||||
const impliedCompilerOptions: Record<string, CompilerOptionsValue> = {};
|
||||
for (const option in computedOptions) {
|
||||
if (!providedKeys.has(option) && some(computedOptions[option as keyof typeof computedOptions].dependencies, dep => providedKeys.has(dep))) {
|
||||
const implied = computedOptions[option as keyof typeof computedOptions].computeValue(configParseResult.options);
|
||||
const defaultValue = computedOptions[option as keyof typeof computedOptions].computeValue({});
|
||||
if (implied !== defaultValue) {
|
||||
impliedCompilerOptions[option] = computedOptions[option as keyof typeof computedOptions].computeValue(configParseResult.options);
|
||||
}
|
||||
}
|
||||
}
|
||||
assign(config.compilerOptions, optionMapToObject(serializeCompilerOptions(impliedCompilerOptions, pathOptions)));
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
@ -8587,54 +8587,272 @@ export function getSetExternalModuleIndicator(options: CompilerOptions): (file:
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getEmitScriptTarget(compilerOptions: { module?: CompilerOptions["module"]; target?: CompilerOptions["target"]; }): ScriptTarget {
|
||||
return compilerOptions.target ??
|
||||
((compilerOptions.module === ModuleKind.Node16 && ScriptTarget.ES2022) ||
|
||||
(compilerOptions.module === ModuleKind.NodeNext && ScriptTarget.ESNext) ||
|
||||
ScriptTarget.ES5);
|
||||
type CompilerOptionKeys = keyof { [K in keyof CompilerOptions as string extends K ? never : K]: any; };
|
||||
function createComputedCompilerOptions<T extends Record<string, CompilerOptionKeys[]>>(
|
||||
options: {
|
||||
[K in keyof T & CompilerOptionKeys | StrictOptionName]: {
|
||||
dependencies: T[K];
|
||||
computeValue: (compilerOptions: Pick<CompilerOptions, K | T[K][number]>) => Exclude<CompilerOptions[K], undefined>;
|
||||
};
|
||||
},
|
||||
) {
|
||||
return options;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getEmitModuleKind(compilerOptions: { module?: CompilerOptions["module"]; target?: CompilerOptions["target"]; }) {
|
||||
return typeof compilerOptions.module === "number" ?
|
||||
compilerOptions.module :
|
||||
getEmitScriptTarget(compilerOptions) >= ScriptTarget.ES2015 ? ModuleKind.ES2015 : ModuleKind.CommonJS;
|
||||
}
|
||||
export const computedOptions = createComputedCompilerOptions({
|
||||
target: {
|
||||
dependencies: ["module"],
|
||||
computeValue: compilerOptions => {
|
||||
return compilerOptions.target ??
|
||||
((compilerOptions.module === ModuleKind.Node16 && ScriptTarget.ES2022) ||
|
||||
(compilerOptions.module === ModuleKind.NodeNext && ScriptTarget.ESNext) ||
|
||||
ScriptTarget.ES5);
|
||||
},
|
||||
},
|
||||
module: {
|
||||
dependencies: ["target"],
|
||||
computeValue: (compilerOptions): ModuleKind => {
|
||||
return typeof compilerOptions.module === "number" ?
|
||||
compilerOptions.module :
|
||||
computedOptions.target.computeValue(compilerOptions) >= ScriptTarget.ES2015 ? ModuleKind.ES2015 : ModuleKind.CommonJS;
|
||||
},
|
||||
},
|
||||
moduleResolution: {
|
||||
dependencies: ["module", "target"],
|
||||
computeValue: (compilerOptions): ModuleResolutionKind => {
|
||||
let moduleResolution = compilerOptions.moduleResolution;
|
||||
if (moduleResolution === undefined) {
|
||||
switch (computedOptions.module.computeValue(compilerOptions)) {
|
||||
case ModuleKind.CommonJS:
|
||||
moduleResolution = ModuleResolutionKind.Node10;
|
||||
break;
|
||||
case ModuleKind.Node16:
|
||||
moduleResolution = ModuleResolutionKind.Node16;
|
||||
break;
|
||||
case ModuleKind.NodeNext:
|
||||
moduleResolution = ModuleResolutionKind.NodeNext;
|
||||
break;
|
||||
default:
|
||||
moduleResolution = ModuleResolutionKind.Classic;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return moduleResolution;
|
||||
},
|
||||
},
|
||||
moduleDetection: {
|
||||
dependencies: ["module", "target"],
|
||||
computeValue: (compilerOptions): ModuleDetectionKind => {
|
||||
return compilerOptions.moduleDetection ||
|
||||
(computedOptions.module.computeValue(compilerOptions) === ModuleKind.Node16 ||
|
||||
computedOptions.module.computeValue(compilerOptions) === ModuleKind.NodeNext ? ModuleDetectionKind.Force : ModuleDetectionKind.Auto);
|
||||
},
|
||||
},
|
||||
isolatedModules: {
|
||||
dependencies: ["verbatimModuleSyntax"],
|
||||
computeValue: compilerOptions => {
|
||||
return !!(compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax);
|
||||
},
|
||||
},
|
||||
esModuleInterop: {
|
||||
dependencies: ["module", "target"],
|
||||
computeValue: (compilerOptions): boolean => {
|
||||
if (compilerOptions.esModuleInterop !== undefined) {
|
||||
return compilerOptions.esModuleInterop;
|
||||
}
|
||||
switch (computedOptions.module.computeValue(compilerOptions)) {
|
||||
case ModuleKind.Node16:
|
||||
case ModuleKind.NodeNext:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
allowSyntheticDefaultImports: {
|
||||
dependencies: ["module", "target", "moduleResolution"],
|
||||
computeValue: (compilerOptions): boolean => {
|
||||
if (compilerOptions.allowSyntheticDefaultImports !== undefined) {
|
||||
return compilerOptions.allowSyntheticDefaultImports;
|
||||
}
|
||||
return computedOptions.esModuleInterop.computeValue(compilerOptions)
|
||||
|| computedOptions.module.computeValue(compilerOptions) === ModuleKind.System
|
||||
|| computedOptions.moduleResolution.computeValue(compilerOptions) === ModuleResolutionKind.Bundler;
|
||||
},
|
||||
},
|
||||
resolvePackageJsonExports: {
|
||||
dependencies: ["moduleResolution"],
|
||||
computeValue: (compilerOptions): boolean => {
|
||||
const moduleResolution = computedOptions.moduleResolution.computeValue(compilerOptions);
|
||||
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
||||
return false;
|
||||
}
|
||||
if (compilerOptions.resolvePackageJsonExports !== undefined) {
|
||||
return compilerOptions.resolvePackageJsonExports;
|
||||
}
|
||||
switch (moduleResolution) {
|
||||
case ModuleResolutionKind.Node16:
|
||||
case ModuleResolutionKind.NodeNext:
|
||||
case ModuleResolutionKind.Bundler:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
resolvePackageJsonImports: {
|
||||
dependencies: ["moduleResolution", "resolvePackageJsonExports"],
|
||||
computeValue: (compilerOptions): boolean => {
|
||||
const moduleResolution = computedOptions.moduleResolution.computeValue(compilerOptions);
|
||||
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
||||
return false;
|
||||
}
|
||||
if (compilerOptions.resolvePackageJsonExports !== undefined) {
|
||||
return compilerOptions.resolvePackageJsonExports;
|
||||
}
|
||||
switch (moduleResolution) {
|
||||
case ModuleResolutionKind.Node16:
|
||||
case ModuleResolutionKind.NodeNext:
|
||||
case ModuleResolutionKind.Bundler:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
resolveJsonModule: {
|
||||
dependencies: ["moduleResolution", "module", "target"],
|
||||
computeValue: (compilerOptions): boolean => {
|
||||
if (compilerOptions.resolveJsonModule !== undefined) {
|
||||
return compilerOptions.resolveJsonModule;
|
||||
}
|
||||
return computedOptions.moduleResolution.computeValue(compilerOptions) === ModuleResolutionKind.Bundler;
|
||||
},
|
||||
},
|
||||
declaration: {
|
||||
dependencies: ["composite"],
|
||||
computeValue: compilerOptions => {
|
||||
return !!(compilerOptions.declaration || compilerOptions.composite);
|
||||
},
|
||||
},
|
||||
preserveConstEnums: {
|
||||
dependencies: ["isolatedModules", "verbatimModuleSyntax"],
|
||||
computeValue: (compilerOptions): boolean => {
|
||||
return !!(compilerOptions.preserveConstEnums || computedOptions.isolatedModules.computeValue(compilerOptions));
|
||||
},
|
||||
},
|
||||
incremental: {
|
||||
dependencies: ["composite"],
|
||||
computeValue: compilerOptions => {
|
||||
return !!(compilerOptions.incremental || compilerOptions.composite);
|
||||
},
|
||||
},
|
||||
declarationMap: {
|
||||
dependencies: ["declaration", "composite"],
|
||||
computeValue: (compilerOptions): boolean => {
|
||||
return !!(compilerOptions.declarationMap && computedOptions.declaration.computeValue(compilerOptions));
|
||||
},
|
||||
},
|
||||
allowJs: {
|
||||
dependencies: ["checkJs"],
|
||||
computeValue: compilerOptions => {
|
||||
return compilerOptions.allowJs === undefined ? !!compilerOptions.checkJs : compilerOptions.allowJs;
|
||||
},
|
||||
},
|
||||
useDefineForClassFields: {
|
||||
dependencies: ["target", "module"],
|
||||
computeValue: (compilerOptions): boolean => {
|
||||
return compilerOptions.useDefineForClassFields === undefined
|
||||
? computedOptions.target.computeValue(compilerOptions) >= ScriptTarget.ES2022
|
||||
: compilerOptions.useDefineForClassFields;
|
||||
},
|
||||
},
|
||||
noImplicitAny: {
|
||||
dependencies: ["strict"],
|
||||
computeValue: compilerOptions => {
|
||||
return getStrictOptionValue(compilerOptions, "noImplicitAny");
|
||||
},
|
||||
},
|
||||
noImplicitThis: {
|
||||
dependencies: ["strict"],
|
||||
computeValue: compilerOptions => {
|
||||
return getStrictOptionValue(compilerOptions, "noImplicitThis");
|
||||
},
|
||||
},
|
||||
strictNullChecks: {
|
||||
dependencies: ["strict"],
|
||||
computeValue: compilerOptions => {
|
||||
return getStrictOptionValue(compilerOptions, "strictNullChecks");
|
||||
},
|
||||
},
|
||||
strictFunctionTypes: {
|
||||
dependencies: ["strict"],
|
||||
computeValue: compilerOptions => {
|
||||
return getStrictOptionValue(compilerOptions, "strictFunctionTypes");
|
||||
},
|
||||
},
|
||||
strictBindCallApply: {
|
||||
dependencies: ["strict"],
|
||||
computeValue: compilerOptions => {
|
||||
return getStrictOptionValue(compilerOptions, "strictBindCallApply");
|
||||
},
|
||||
},
|
||||
strictPropertyInitialization: {
|
||||
dependencies: ["strict"],
|
||||
computeValue: compilerOptions => {
|
||||
return getStrictOptionValue(compilerOptions, "strictPropertyInitialization");
|
||||
},
|
||||
},
|
||||
alwaysStrict: {
|
||||
dependencies: ["strict"],
|
||||
computeValue: compilerOptions => {
|
||||
return getStrictOptionValue(compilerOptions, "alwaysStrict");
|
||||
},
|
||||
},
|
||||
useUnknownInCatchVariables: {
|
||||
dependencies: ["strict"],
|
||||
computeValue: compilerOptions => {
|
||||
return getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/** @internal */
|
||||
export const getEmitScriptTarget = computedOptions.target.computeValue;
|
||||
/** @internal */
|
||||
export const getEmitModuleKind = computedOptions.module.computeValue;
|
||||
/** @internal */
|
||||
export const getEmitModuleResolutionKind = computedOptions.moduleResolution.computeValue;
|
||||
/** @internal */
|
||||
export const getEmitModuleDetectionKind = computedOptions.moduleDetection.computeValue;
|
||||
/** @internal */
|
||||
export const getIsolatedModules = computedOptions.isolatedModules.computeValue;
|
||||
/** @internal */
|
||||
export const getESModuleInterop = computedOptions.esModuleInterop.computeValue;
|
||||
/** @internal */
|
||||
export const getAllowSyntheticDefaultImports = computedOptions.allowSyntheticDefaultImports.computeValue;
|
||||
/** @internal */
|
||||
export const getResolvePackageJsonExports = computedOptions.resolvePackageJsonExports.computeValue;
|
||||
/** @internal */
|
||||
export const getResolvePackageJsonImports = computedOptions.resolvePackageJsonImports.computeValue;
|
||||
/** @internal */
|
||||
export const getResolveJsonModule = computedOptions.resolveJsonModule.computeValue;
|
||||
/** @internal */
|
||||
export const getEmitDeclarations = computedOptions.declaration.computeValue;
|
||||
/** @internal */
|
||||
export const shouldPreserveConstEnums = computedOptions.preserveConstEnums.computeValue;
|
||||
/** @internal */
|
||||
export const isIncrementalCompilation = computedOptions.incremental.computeValue;
|
||||
/** @internal */
|
||||
export const getAreDeclarationMapsEnabled = computedOptions.declarationMap.computeValue;
|
||||
/** @internal */
|
||||
export const getAllowJSCompilerOption = computedOptions.allowJs.computeValue;
|
||||
/** @internal */
|
||||
export const getUseDefineForClassFields = computedOptions.useDefineForClassFields.computeValue;
|
||||
|
||||
/** @internal */
|
||||
export function emitModuleKindIsNonNodeESM(moduleKind: ModuleKind) {
|
||||
return moduleKind >= ModuleKind.ES2015 && moduleKind <= ModuleKind.ESNext;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getEmitModuleResolutionKind(compilerOptions: CompilerOptions) {
|
||||
let moduleResolution = compilerOptions.moduleResolution;
|
||||
if (moduleResolution === undefined) {
|
||||
switch (getEmitModuleKind(compilerOptions)) {
|
||||
case ModuleKind.CommonJS:
|
||||
moduleResolution = ModuleResolutionKind.Node10;
|
||||
break;
|
||||
case ModuleKind.Node16:
|
||||
moduleResolution = ModuleResolutionKind.Node16;
|
||||
break;
|
||||
case ModuleKind.NodeNext:
|
||||
moduleResolution = ModuleResolutionKind.NodeNext;
|
||||
break;
|
||||
default:
|
||||
moduleResolution = ModuleResolutionKind.Classic;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return moduleResolution;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getEmitModuleDetectionKind(options: CompilerOptions) {
|
||||
return options.moduleDetection ||
|
||||
(getEmitModuleKind(options) === ModuleKind.Node16 || getEmitModuleKind(options) === ModuleKind.NodeNext ? ModuleDetectionKind.Force : ModuleDetectionKind.Auto);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function hasJsonModuleEmitEnabled(options: CompilerOptions) {
|
||||
switch (getEmitModuleKind(options)) {
|
||||
@ -8652,11 +8870,6 @@ export function hasJsonModuleEmitEnabled(options: CompilerOptions) {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getIsolatedModules(options: CompilerOptions) {
|
||||
return !!(options.isolatedModules || options.verbatimModuleSyntax);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function importNameElisionDisabled(options: CompilerOptions) {
|
||||
return options.verbatimModuleSyntax || options.isolatedModules && options.preserveValueImports;
|
||||
@ -8672,34 +8885,6 @@ export function unusedLabelIsError(options: CompilerOptions): boolean {
|
||||
return options.allowUnusedLabels === false;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getAreDeclarationMapsEnabled(options: CompilerOptions) {
|
||||
return !!(getEmitDeclarations(options) && options.declarationMap);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getESModuleInterop(compilerOptions: CompilerOptions) {
|
||||
if (compilerOptions.esModuleInterop !== undefined) {
|
||||
return compilerOptions.esModuleInterop;
|
||||
}
|
||||
switch (getEmitModuleKind(compilerOptions)) {
|
||||
case ModuleKind.Node16:
|
||||
case ModuleKind.NodeNext:
|
||||
return true;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getAllowSyntheticDefaultImports(compilerOptions: CompilerOptions) {
|
||||
if (compilerOptions.allowSyntheticDefaultImports !== undefined) {
|
||||
return compilerOptions.allowSyntheticDefaultImports;
|
||||
}
|
||||
return getESModuleInterop(compilerOptions)
|
||||
|| getEmitModuleKind(compilerOptions) === ModuleKind.System
|
||||
|| getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Bundler;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution: ModuleResolutionKind): boolean {
|
||||
return moduleResolution >= ModuleResolutionKind.Node16 && moduleResolution <= ModuleResolutionKind.NodeNext
|
||||
@ -8712,65 +8897,6 @@ export function shouldResolveJsRequire(compilerOptions: CompilerOptions): boolea
|
||||
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Bundler;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getResolvePackageJsonExports(compilerOptions: CompilerOptions) {
|
||||
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
||||
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
||||
return false;
|
||||
}
|
||||
if (compilerOptions.resolvePackageJsonExports !== undefined) {
|
||||
return compilerOptions.resolvePackageJsonExports;
|
||||
}
|
||||
switch (moduleResolution) {
|
||||
case ModuleResolutionKind.Node16:
|
||||
case ModuleResolutionKind.NodeNext:
|
||||
case ModuleResolutionKind.Bundler:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getResolvePackageJsonImports(compilerOptions: CompilerOptions) {
|
||||
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
||||
if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
||||
return false;
|
||||
}
|
||||
if (compilerOptions.resolvePackageJsonExports !== undefined) {
|
||||
return compilerOptions.resolvePackageJsonExports;
|
||||
}
|
||||
switch (moduleResolution) {
|
||||
case ModuleResolutionKind.Node16:
|
||||
case ModuleResolutionKind.NodeNext:
|
||||
case ModuleResolutionKind.Bundler:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getResolveJsonModule(compilerOptions: CompilerOptions) {
|
||||
if (compilerOptions.resolveJsonModule !== undefined) {
|
||||
return compilerOptions.resolveJsonModule;
|
||||
}
|
||||
return getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Bundler;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getEmitDeclarations(compilerOptions: CompilerOptions): boolean {
|
||||
return !!(compilerOptions.declaration || compilerOptions.composite);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function shouldPreserveConstEnums(compilerOptions: CompilerOptions): boolean {
|
||||
return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function isIncrementalCompilation(options: CompilerOptions) {
|
||||
return !!(options.incremental || options.composite);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export type StrictOptionName =
|
||||
| "noImplicitAny"
|
||||
@ -8787,16 +8913,6 @@ export function getStrictOptionValue(compilerOptions: CompilerOptions, flag: Str
|
||||
return compilerOptions[flag] === undefined ? !!compilerOptions.strict : !!compilerOptions[flag];
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getAllowJSCompilerOption(compilerOptions: CompilerOptions): boolean {
|
||||
return compilerOptions.allowJs === undefined ? !!compilerOptions.checkJs : compilerOptions.allowJs;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getUseDefineForClassFields(compilerOptions: CompilerOptions): boolean {
|
||||
return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) >= ScriptTarget.ES2022 : compilerOptions.useDefineForClassFields;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function getEmitStandardClassFields(compilerOptions: CompilerOptions) {
|
||||
return compilerOptions.useDefineForClassFields !== false && getEmitScriptTarget(compilerOptions) >= ScriptTarget.ES2022;
|
||||
|
||||
@ -3,7 +3,16 @@
|
||||
"esModuleInterop": true,
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"strict": true
|
||||
"strict": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictBindCallApply": true,
|
||||
"strictPropertyInitialization": true,
|
||||
"alwaysStrict": true,
|
||||
"useUnknownInCatchVariables": true
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
|
||||
@ -25,7 +25,8 @@
|
||||
},
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"resolveJsonModule": true
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*"
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"checkJs": true
|
||||
"checkJs": true,
|
||||
"allowJs": true
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true
|
||||
"composite": true,
|
||||
"declaration": true,
|
||||
"incremental": true
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"isolatedModules": true
|
||||
"isolatedModules": true,
|
||||
"preserveConstEnums": true
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "none"
|
||||
"module": "none",
|
||||
"moduleResolution": "classic"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"strict": true
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictBindCallApply": true,
|
||||
"strictPropertyInitialization": true,
|
||||
"alwaysStrict": true,
|
||||
"useUnknownInCatchVariables": true
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"verbatimModuleSyntax": true
|
||||
"verbatimModuleSyntax": true,
|
||||
"isolatedModules": true,
|
||||
"preserveConstEnums": true
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user