Negated Types: Change the meaning of {} to unknown & not null & not undefined - #64376
Open
Wesley Wigham (weswigham) wants to merge 2 commits into
Open
Wesley Wigham (weswigham) wants to merge 2 commits into
Wesley Wigham (weswigham) wants to merge 2 commits into
Conversation
Reduce string & {}, number & {}, and bigint & {} normally. Preserve redundant literals alongside their matching broad primitive in sparse origin metadata. Use the origins for completions, quick info, and mapped-key enumeration without changing ordinary type printing. Recognize origin-bearing primitive copies in index-signature and union comparisons.
Strada history:
- #28429 first allowed string & {} to survive by preserving actual empty object intersections.
#28429
- #49119 introduced noSupertypeReduction for string, number, and bigint intersections, explicitly documenting and testing the completion exception in completionPreferredSuggestions1.ts.
#49119
Represent {} under strictNullChecks as unknown & not null & not undefined. Remove the synthetic unknown union, recombination helpers, and unknown-like union assignability special case. Narrow nullish types directly through intersections and exclusions.
Replace the {} | null | undefined formulation introduced by #49119 while preserving apparent members, empty-type identity, and generic indexed access.
#49119
Copilot started reviewing on behalf of
Wesley Wigham (weswigham)
September 21, 2026 17:53
View session
Wesley Wigham (weswigham)
changed the base branch from
main
to
weswigham/negated-types
September 21, 2026 18:01
Wesley Wigham (weswigham)
added this pull request to stack #64377
September 21, 2026 18:01
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Critical unsound assignability and unresolved normalization, narrowing, and completion regressions block approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (3)
What changed in this PR
Adds negated types (not T) and redefines {} as non-nullish unknown across the compiler, language services, APIs, and tests.
Changes:
- Implements negated-type parsing, normalization, inference, narrowing, and emit.
- Preserves literal origins for hover and completions.
- Updates public APIs and extensive compiler baselines.
| File | Summary |
|---|---|
tsc/testdata/tests/cases/conformance/types/negated/negatedUnionComplementSimplifies.ts |
Tests union-complement simplification. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesSimplifyInIntersections.ts |
Tests intersection simplification. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesSatisfiesAndArrays.ts |
Tests arrays and satisfies. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesNormalizationIdentities.ts |
Tests normalization identities. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesInStringMappingAndIndexSignatures.ts |
Tests string mappings and index signatures. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesInStringMapping.ts |
Tests string mappings. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesInPatternLiteralsStringMappingAndIndexSignatures.ts |
Tests combined pattern-literal behavior. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesInPatternLiteralsAndStringMapping.ts |
Tests pattern literals and mappings. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesInPatternLiteralsAndIndexSignatures.ts |
Tests pattern-literal index signatures. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesInPatternLiterals.ts |
Tests pattern literals. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesInKeyofAndMappedKeyRemapping.ts |
Tests keyof and key remapping. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesInIndexSignatures.ts |
Tests index signatures. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesInConditionalTypesAndInfer.ts |
Tests conditional types and inference. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesGenericInference.ts |
Tests generic inference. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesDeMorgan.ts |
Tests De Morgan identities. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesDeclarationEmit.ts |
Tests declaration emit. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesControlFlowNarrowing.ts |
Tests control-flow narrowing. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesControlFlow.ts |
Tests control-flow behavior. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesContextualLiteralTypes.ts |
Tests contextual literals. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypesComparability.ts |
Tests comparability. |
tsc/testdata/tests/cases/conformance/types/negated/negatedTypeAppliesToFalseBranchOfConditional.ts |
Tests conditional false-branch narrowing. |
tsc/testdata/tests/cases/conformance/types/negated/negatedRepresentativeExamples.ts |
Adds representative examples. |
tsc/testdata/tests/cases/conformance/types/negated/negatedNarrowingTypePredicate.ts |
Tests predicate narrowing. |
tsc/testdata/tests/cases/conformance/types/negated/negatedNarrowingTruthiness.ts |
Tests truthiness narrowing. |
tsc/testdata/tests/cases/conformance/types/negated/negatedNarrowingSwitchTypeof.ts |
Tests typeof switch narrowing. |
tsc/testdata/tests/cases/conformance/types/negated/negatedNarrowingSwitchTrue.ts |
Tests switch (true) narrowing. |
tsc/testdata/tests/cases/conformance/types/negated/negatedNarrowingInOperator.ts |
Tests in narrowing. |
tsc/testdata/tests/cases/conformance/types/negated/negatedNarrowingEqualityLiteral.ts |
Tests literal equality narrowing. |
tsc/testdata/tests/cases/conformance/types/negated/negatedNarrowingEquality.ts |
Tests equality narrowing. |
tsc/testdata/tests/cases/conformance/types/negated/negatedNarrowingAssertion.ts |
Tests assertion narrowing. |
tsc/testdata/tests/cases/conformance/types/negated/negatedInMappedTypeDisablesExcessProperties.ts |
Tests mapped excess-property behavior. |
tsc/testdata/tests/cases/conformance/types/negated/negatedFreshOptionalProperties.ts |
Tests fresh optional properties. |
tsc/testdata/tests/cases/compiler/negatedTypeSmokeTypeof.ts |
Adds typeof smoke coverage. |
tsc/testdata/tests/cases/compiler/negatedTypeSmokeNullable.ts |
Adds nullable smoke coverage. |
tsc/testdata/tests/cases/compiler/negatedTypeSmokeInference.ts |
Adds inference smoke coverage. |
tsc/testdata/tests/cases/compiler/negatedRealWorldControlFlowRegressions.ts |
Covers control-flow regressions. |
tsc/testdata/tests/cases/compiler/negatedPartialTypeGuards.ts |
Tests partial type guards. |
tsc/testdata/tests/cases/compiler/negatedNumericEnumComparability.ts |
Tests numeric enum comparability. |
tsc/testdata/tests/cases/compiler/negatedGenericForIn.ts |
Tests generic for...in. |
tsc/testdata/tests/cases/compiler/negatedCompoundAssignmentFlow.ts |
Tests compound-assignment flow. |
tsc/testdata/fixtures/compiler/commandLineParser.ts |
Updates compiler fixture typing. |
tsc/testdata/fixtures/compiler/checker.ts |
Updates checker fixture behavior. |
tsc/testdata/baselines/reference/conformance/weakTypesAndLiterals01.js |
Updates emit baseline. |
tsc/testdata/baselines/reference/conformance/unknownType1.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/unknownControlFlow.js |
Updates emit baseline. |
tsc/testdata/baselines/reference/conformance/undefinedAssignableToEveryType.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/TypeGuardWithEnumUnion.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/thisTypeInFunctions2.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/thisTypeInFunctions2.symbols |
Updates symbol baseline. |
tsc/testdata/baselines/reference/conformance/templateLiteralTypes2.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/stringLiteralTypesOverloads02.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/stringLiteralTypesInUnionTypes02.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/staticIndexSignature4.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/spreadObjectOrFalsy.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/spreadObjectOrFalsy.js |
Updates emit baseline. |
tsc/testdata/baselines/reference/conformance/scannerS7.3_A1.1_T2.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/scannerS7.2_A1.5_T2.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/privateNameInInExpression(target=esnext).errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/privateNameInInExpression(target=es2022).errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/parserUnicode1.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/parserS7.3_A1.1_T2.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/parserS7.2_A1.5_T2.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/parserharness.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/nullishCoalescingOperator2.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/nullishCoalescingOperator_es2020.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/noInfer.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypesSimplifyInIntersections.types |
Adds type baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypesSimplifyInIntersections.symbols |
Adds symbol baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypesSimplifyInIntersections.js |
Adds emit baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypesNormalizationIdentities.errors.txt |
Adds diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypesDeclarationEmit.types |
Adds type baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypesDeclarationEmit.js |
Adds emit baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypesControlFlow.js |
Adds emit baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypesComparability.types |
Adds type baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypesComparability.symbols |
Adds symbol baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypesComparability.errors.txt |
Adds diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypeAppliesToFalseBranchOfConditional.types |
Adds type baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypeAppliesToFalseBranchOfConditional.symbols |
Adds symbol baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypeAppliesToFalseBranchOfConditional.js |
Adds emit baseline. |
tsc/testdata/baselines/reference/conformance/negatedTypeAppliesToFalseBranchOfConditional.errors.txt |
Adds diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/negatedNarrowingTypePredicate.errors.txt |
Adds diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/negatedNarrowingTruthiness.types |
Adds type baseline. |
tsc/testdata/baselines/reference/conformance/negatedNarrowingInOperator.errors.txt |
Adds diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/negatedInMappedTypeDisablesExcessProperties.types |
Adds type baseline. |
tsc/testdata/baselines/reference/conformance/negatedInMappedTypeDisablesExcessProperties.js |
Adds emit baseline. |
tsc/testdata/baselines/reference/conformance/negatedInMappedTypeDisablesExcessProperties.errors.txt |
Adds diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/negatedFreshOptionalProperties(exactoptionalpropertytypes=true).types |
Adds type baseline. |
tsc/testdata/baselines/reference/conformance/negatedFreshOptionalProperties(exactoptionalpropertytypes=true).symbols |
Adds symbol baseline. |
tsc/testdata/baselines/reference/conformance/negatedFreshOptionalProperties(exactoptionalpropertytypes=true).js |
Adds emit baseline. |
tsc/testdata/baselines/reference/conformance/negatedFreshOptionalProperties(exactoptionalpropertytypes=true).errors.txt |
Adds diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/negatedFreshOptionalProperties(exactoptionalpropertytypes=false).types |
Adds type baseline. |
tsc/testdata/baselines/reference/conformance/negatedFreshOptionalProperties(exactoptionalpropertytypes=false).symbols |
Adds symbol baseline. |
tsc/testdata/baselines/reference/conformance/negatedFreshOptionalProperties(exactoptionalpropertytypes=false).js |
Adds emit baseline. |
tsc/testdata/baselines/reference/conformance/negatedFreshOptionalProperties(exactoptionalpropertytypes=false).errors.txt |
Adds diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/logicalOrOperatorWithTypeParameters.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/logicalAssignment4(target=esnext).types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/logicalAssignment4(target=es2021).types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/logicalAssignment4(target=es2020).types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/logicalAssignment4(target=es2015).types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/literalTypes3.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/keyofAndIndexedAccess.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/intersectionsAndEmptyObjects.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/controlFlowWithTemplateLiterals.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/controlFlowIfStatement.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/controlFlowGenericTypes.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/conditionalTypes1.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/classStaticBlock8.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/checkJsxChildrenCanBeTupleType.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/checkJsxChildrenCanBeTupleType.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/conformance/bivariantInferences.types |
Updates type baseline. |
tsc/testdata/baselines/reference/conformance/assertionTypePredicates1.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/weakTypeAndPrimitiveNarrowing.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/voidUndefinedReduction.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/unusedPrivateStaticMembers.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/unreachableSwitchTypeofUnknown.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/unknownLikeUnionObjectFlagsNotPropagated.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/undefinedAsDiscriminantWithUnknown(strictnullchecks=true).types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/typeVariableConstraintIntersections.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/typePredicateWithThisParameter.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/typePredicatesOptionalChaining1.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/typeInferenceTypePredicate.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/tsxNotUsingApparentTypeOfSFC.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/styledComponentsInstantiaionLimitNotReached.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/strictOptionalProperties1.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/strictNullNotNullIndexTypeNoLib.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/specialIntersectionsInMappedTypes.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/simpleRecursionWithBaseCase1.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/recursiveTypeRelations.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/patternAmbientModuleAugmentationMergedSymbol.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/observableInferenceCanBeMade.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/nullishCoalescingAlwaysNullFalsePositive.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/nonNullableTypes1.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/noImplicitAnyForIn.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/nestedGenericTypeInference.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/negatedTypeSmokeTypeof(strict=false).errors.txt |
Adds diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/negatedTypeSmokeInference.errors.txt |
Adds diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/negatedPartialTypeGuards.errors.txt |
Adds diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/negatedNumericEnumComparability.types |
Adds type baseline. |
tsc/testdata/baselines/reference/compiler/negatedNumericEnumComparability.errors.txt |
Adds diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/narrowingUnionToUnion.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/narrowingTypeofUndefined2.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/narrowingPastLastAssignment.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/narrowingByTypeofInSwitch.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/narrowByEquality.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/narrowByBooleanComparison.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/mergeSymbolReexportedTypeAliasInstantiation.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/jsxNamespaceImplicitImportJSXNamespace.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/jsxNamespaceGlobalReexportMissingAliasTarget.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/jsxNamespaceGlobalReexport.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/jsxExcessPropsAndAssignability.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/inKeywordTypeguard(strict=true).types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/inKeywordTypeguard(strict=true).errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/inferTypePredicates.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/inferTypePredicates.js |
Updates emit baseline. |
tsc/testdata/baselines/reference/compiler/inferenceExactOptionalProperties2.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/inferenceExactOptionalProperties2.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/inferenceDoesNotAddUndefinedOrNull.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/inDoesNotOperateOnPrimitiveTypes.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/inDoesNotOperateOnPrimitiveTypes.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/indexerAssignability.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/implicitIndexSignatures.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/implicitEmptyObjectType.errors.txt |
Removes an existing diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/genericUnboundedTypeParamAssignability.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/genericPrototypeProperty3.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/genericInferenceDefaultTypeParameterJsxReact.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/fixCrashAliasLookupForDefauledImport.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/expandoContextualTypes.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/excessiveStackDepthFlatArray.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/emptyThenWithoutWarning.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/emptyAnonymousObjectNarrowing(strictnullchecks=true).types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/emptyAnonymousObjectNarrowing(strictnullchecks=false).types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/doubleUnderscoreLabels.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/distributiveConditionalTypeConstraints.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/declFileTypeAnnotationStringLiteral(target=es2015).types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/continueInLoopsWithCapturedBlockScopedBindings1(target=es2015).types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/contextualTypeBasedOnIntersectionWithAnyInTheMix1.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/contextualTypeBasedOnIntersectionWithAnyInTheMix1.errors.txt |
Updates diagnostic baseline. |
tsc/testdata/baselines/reference/compiler/constructorWithCapturedSuper.types |
Updates type baseline. |
tsc/testdata/baselines/reference/compiler/assertionFunctionWildcardImport2.types |
Updates type baseline. |
tsc/internal/scanner/scanner.go |
Recognizes not syntax. |
tsc/internal/parser/parser.go |
Parses negated type operators. |
tsc/internal/ls/string_completions.go |
Uses literal origins for completions. |
tsc/internal/ls/hover.go |
Displays literal origins in hover. |
tsc/internal/fourslash/tests/stringLiteralCompletionsForOpenEndedTemplateLiteralType_test.go |
Updates completion expectations. |
tsc/internal/fourslash/tests/specialIntersectionsOrderIndependent_test.go |
Updates intersection completion tests. |
tsc/internal/checker/nodebuilderimpl.go |
Emits negated and non-nullish types. |
tsc/internal/checker/inference.go |
Supports inference through negation. |
tsc/internal/checker/exports.go |
Exposes negated-type construction. |
tsc/internal/api/session.go |
Handles negated-type API requests. |
tsc/internal/api/proto.go |
Registers the API method. |
tsc/internal/api/encoder/encoder_generated.go |
Encodes negated AST nodes. |
tsc/internal/api/encoder/decoder_generated.go |
Decodes negated AST nodes. |
tools/scripts/tsc/ast.json |
Defines negated AST metadata. |
packages/typescript/test/sync/api.test.ts |
Tests synchronous APIs. |
packages/typescript/test/sync/api-generators.test.ts |
Tests generated synchronous APIs. |
packages/typescript/test/async/api.test.ts |
Tests asynchronous APIs. |
packages/typescript/src/enums/typeFlags.enum.ts |
Adds the negated type flag. |
packages/typescript/src/enums/objectFlags.ts |
Updates generated object flags. |
packages/typescript/src/enums/objectFlags.enum.ts |
Adds negation-related object flags. |
packages/typescript/src/ast/factory.generated.ts |
Constructs negated type operators. |
packages/typescript/src/ast/ast.generated.ts |
Adds negated operator AST support. |
packages/typescript/src/api/sync/types.ts |
Exposes synchronous negation APIs. |
packages/typescript/src/api/proto.generated.ts |
Adds generated protocol declarations. |
packages/typescript/src/api/node/node.generated.ts |
Decodes negated operator nodes. |
packages/typescript/src/api/node/encoder.generated.ts |
Encodes negated operator nodes. |
packages/typescript/src/api/async/types.ts |
Exposes asynchronous negation APIs. |
packages/typescript/src/api/async/api.ts |
Implements asynchronous negation calls. |
Files not reviewed (1)
- tsc/internal/api/enum_values_generated.go: Generated file
Comment on lines
+22182
to
+22183
| if c.isNonNullishUnknownType(t) { | ||
| return c.emptyObjectType |
Comment on lines
26
to
28
| Exact: []fourslash.CompletionsExpectedItem{ | ||
| "dataDowncast", | ||
| "downcast", | ||
| "editingDowncast", | ||
| }, |
| for (const p of arg) { } | ||
| >p : unknown | ||
| >arg : T & {} | ||
| >arg : T & not undefined & not undefined |
Member
Author
|
TypeScript Bot (@typescript-bot) test top1000 |
|
Hey Wesley Wigham (@weswigham), this PR changed while I was preparing the test run. Please try again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This PR stacks on top of #64375.
In this PR, we drop the
unknown = {} | null | undefinedequivalence we use in a few places, and instead choose to interpret{}asunknown & not null & not undefined. In doing so, I had to choose to either persist our special behaviors for literal unions withbase & {}as non-simplifying, or replace it. I chose to eliminate that, and instead broadened our existing type-origin machinery to be able to apply to clones ofstring/number/bigint, so you can have astringthat comes from"a" | "b" | string, which shows that origin in quickinfo and uses it for completions (...and mapped type construction, which feels wrong, but is what we needed for compat with the old way). An alternative would be a new carve-out that recognized the new negated types to disable normalization, but that feels.... weird. I think handling the origin information in a first-class way ends up working a bit more nicely than allowing (some) denormalized unions outside of.origins, conceptually.