diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 089a2630dd8c6..9e117cdfd8fe9 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -4507,6 +4507,7 @@ namespace FourSlashInterface { typeEntry("Record"), typeEntry("Exclude"), typeEntry("Extract"), + typeEntry("Omit"), typeEntry("NonNullable"), typeEntry("Parameters"), typeEntry("ConstructorParameters"), diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 458dc8b925216..79fd72ac9375c 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1443,6 +1443,11 @@ type Exclude = T extends U ? never : T; */ type Extract = T extends U ? T : never; +/** + * Construct a type with the properties of T except for those in type K. + */ +type Omit = Pick>; + /** * Exclude null and undefined from T */ diff --git a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.js b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.js index 724a8f8dbeadb..fdeff927f6ba9 100644 --- a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.js +++ b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.js @@ -45,10 +45,14 @@ const myStoreConnect: Connect = function( mergeProps, options, ); -}; +}; + +export {}; + //// [circularlySimplifyingConditionalTypesNoCrash.js] "use strict"; +exports.__esModule = true; var myStoreConnect = function (mapStateToProps, mapDispatchToProps, mergeProps, options) { if (options === void 0) { options = {}; } return connect(mapStateToProps, mapDispatchToProps, mergeProps, options); diff --git a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.symbols b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.symbols index 97abdadf2b39e..9b7f5dd22ca3c 100644 --- a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.symbols +++ b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.symbols @@ -152,3 +152,6 @@ const myStoreConnect: Connect = function( ); }; + +export {}; + diff --git a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types index 4a3a1fdbe53aa..e7690eee85027 100644 --- a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types +++ b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types @@ -90,3 +90,6 @@ const myStoreConnect: Connect = function( ); }; + +export {}; + diff --git a/tests/baselines/reference/indexedAccessRetainsIndexSignature.js b/tests/baselines/reference/indexedAccessRetainsIndexSignature.js index 929525157794d..7d16717bae91e 100644 --- a/tests/baselines/reference/indexedAccessRetainsIndexSignature.js +++ b/tests/baselines/reference/indexedAccessRetainsIndexSignature.js @@ -8,8 +8,10 @@ type Omit1 = Pick>; type Omit2 = {[P in Diff]: T[P]}; type O = Omit<{ a: number, b: string }, 'a'> -const o: O = { b: '' } +export const o: O = { b: '' } //// [indexedAccessRetainsIndexSignature.js] -var o = { b: '' }; +"use strict"; +exports.__esModule = true; +exports.o = { b: '' }; diff --git a/tests/baselines/reference/indexedAccessRetainsIndexSignature.symbols b/tests/baselines/reference/indexedAccessRetainsIndexSignature.symbols index f6d65f9cf6ff2..94b8fcd070f26 100644 --- a/tests/baselines/reference/indexedAccessRetainsIndexSignature.symbols +++ b/tests/baselines/reference/indexedAccessRetainsIndexSignature.symbols @@ -55,8 +55,8 @@ type O = Omit<{ a: number, b: string }, 'a'> >a : Symbol(a, Decl(indexedAccessRetainsIndexSignature.ts, 8, 15)) >b : Symbol(b, Decl(indexedAccessRetainsIndexSignature.ts, 8, 26)) -const o: O = { b: '' } ->o : Symbol(o, Decl(indexedAccessRetainsIndexSignature.ts, 9, 5)) +export const o: O = { b: '' } +>o : Symbol(o, Decl(indexedAccessRetainsIndexSignature.ts, 9, 12)) >O : Symbol(O, Decl(indexedAccessRetainsIndexSignature.ts, 6, 67)) ->b : Symbol(b, Decl(indexedAccessRetainsIndexSignature.ts, 9, 14)) +>b : Symbol(b, Decl(indexedAccessRetainsIndexSignature.ts, 9, 21)) diff --git a/tests/baselines/reference/indexedAccessRetainsIndexSignature.types b/tests/baselines/reference/indexedAccessRetainsIndexSignature.types index 2f79f6f849863..5e92e67279dc3 100644 --- a/tests/baselines/reference/indexedAccessRetainsIndexSignature.types +++ b/tests/baselines/reference/indexedAccessRetainsIndexSignature.types @@ -21,7 +21,7 @@ type O = Omit<{ a: number, b: string }, 'a'> >a : number >b : string -const o: O = { b: '' } +export const o: O = { b: '' } >o : Pick<{ a: number; b: string; }, "b"> >{ b: '' } : { b: string; } >b : string diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.js b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.js index 2eeda64fc989b..69e1108ad300d 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.js +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.js @@ -143,6 +143,8 @@ const Test1 = connect( null, mapDispatchToProps )(TestComponent); + +export {}; //// [reactReduxLikeDeferredInferenceAllowsAssignment.js] @@ -196,6 +198,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } }; var _this = this; +exports.__esModule = true; var simpleAction = function (payload) { return ({ type: "SIMPLE_ACTION", payload: payload diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.symbols b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.symbols index ec954dfde7951..85daf38368a23 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.symbols +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.symbols @@ -469,3 +469,5 @@ const Test1 = connect( )(TestComponent); >TestComponent : Symbol(TestComponent, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 134, 1)) +export {}; + diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.types b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.types index 767d94535cbc9..4772a8065218e 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.types +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.types @@ -286,3 +286,5 @@ const Test1 = connect( )(TestComponent); >TestComponent : typeof TestComponent +export {}; + diff --git a/tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts b/tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts index ccacb10dd2d64..34e5a1b0f4c5b 100644 --- a/tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts +++ b/tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts @@ -45,4 +45,6 @@ const myStoreConnect: Connect = function( mergeProps, options, ); -}; \ No newline at end of file +}; + +export {}; diff --git a/tests/cases/compiler/indexedAccessRetainsIndexSignature.ts b/tests/cases/compiler/indexedAccessRetainsIndexSignature.ts index 11abf771edcb9..36b7c4825061d 100644 --- a/tests/cases/compiler/indexedAccessRetainsIndexSignature.ts +++ b/tests/cases/compiler/indexedAccessRetainsIndexSignature.ts @@ -7,4 +7,4 @@ type Omit1 = Pick>; type Omit2 = {[P in Diff]: T[P]}; type O = Omit<{ a: number, b: string }, 'a'> -const o: O = { b: '' } +export const o: O = { b: '' } diff --git a/tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts b/tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts index 940031c52c2e0..20b18febdc3d0 100644 --- a/tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts +++ b/tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts @@ -143,3 +143,5 @@ const Test1 = connect( null, mapDispatchToProps )(TestComponent); + +export {};