Skip to content

Commit 7b68e77

Browse files
committed
Interestnig brand type
1 parent d60c640 commit 7b68e77

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/compiler/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,7 @@ namespace ts {
17101710
return moduleResolution;
17111711
}
17121712

1713-
export function getStrictOptionValue(compilerOptions: CompilerOptions, flag: "noImplicitAny" | "noImplicitThis" | "strictNullChecks" | "strictFunctionTypes" | "alwaysStrict"): boolean {
1713+
export function getStrictOptionValue(compilerOptions: CompilerOptions, flag: keyof StrictOptions): boolean {
17141714
return compilerOptions[flag] === undefined ? compilerOptions.strict : compilerOptions[flag];
17151715
}
17161716

src/compiler/types.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3676,14 +3676,22 @@ namespace ts {
36763676

36773677
export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike<string[]> | PluginImport[] | null | undefined;
36783678

3679-
export interface CompilerOptions {
3679+
export interface StrictOptions {
3680+
noImplicitAny?: boolean;
3681+
noImplicitThis?: boolean;
3682+
strictNullChecks?: boolean;
3683+
strictFunctionTypes?: boolean;
3684+
alwaysStrict?: boolean;
3685+
}
3686+
3687+
export interface CompilerOptions extends StrictOptions {
36803688
/*@internal*/ all?: boolean;
36813689
allowJs?: boolean;
36823690
/*@internal*/ allowNonTsExtensions?: boolean;
36833691
allowSyntheticDefaultImports?: boolean;
36843692
allowUnreachableCode?: boolean;
36853693
allowUnusedLabels?: boolean;
3686-
alwaysStrict?: boolean; // Always combine with strict property
3694+
/*@internal*/ alwaysStrict?: never & boolean; // Always combine with strict property
36873695
baseUrl?: string;
36883696
charset?: string;
36893697
checkJs?: boolean;
@@ -3722,9 +3730,9 @@ namespace ts {
37223730
noEmitOnError?: boolean;
37233731
noErrorTruncation?: boolean;
37243732
noFallthroughCasesInSwitch?: boolean;
3725-
noImplicitAny?: boolean; // Always combine with strict property
3733+
/*@internal*/ noImplicitAny?: never & boolean; // Always combine with strict property
37263734
noImplicitReturns?: boolean;
3727-
noImplicitThis?: boolean; // Always combine with strict property
3735+
/*@internal*/ noImplicitThis?: never & boolean; // Always combine with strict property
37283736
noStrictGenericChecks?: boolean;
37293737
noUnusedLocals?: boolean;
37303738
noUnusedParameters?: boolean;
@@ -3750,8 +3758,8 @@ namespace ts {
37503758
sourceMap?: boolean;
37513759
sourceRoot?: string;
37523760
strict?: boolean;
3753-
strictFunctionTypes?: boolean; // Always combine with strict property
3754-
strictNullChecks?: boolean; // Always combine with strict property
3761+
/*@internal*/ strictFunctionTypes?: never & boolean; // Always combine with strict property
3762+
/*@internal*/ strictNullChecks?: never & boolean; // Always combine with strict property
37553763
/* @internal */ stripInternal?: boolean;
37563764
suppressExcessPropertyErrors?: boolean;
37573765
suppressImplicitAnyIndexErrors?: boolean;

0 commit comments

Comments
 (0)