Skip to content

Negated Types: Change the meaning of {} to unknown & not null & not undefined - #64376

Open
Wesley Wigham (weswigham) wants to merge 2 commits into
weswigham/negated-typesfrom
weswigham/negated-types-empty-object-meaning
Open

Wesley Wigham (weswigham) wants to merge 2 commits into
weswigham/negated-typesfrom
weswigham/negated-types-empty-object-meaning

Conversation

@weswigham

@weswigham Wesley Wigham (weswigham) commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

This PR stacks on top of #64375.

In this PR, we drop the unknown = {} | null | undefined equivalence we use in a few places, and instead choose to interpret {} as unknown & not null & not undefined. In doing so, I had to choose to either persist our special behaviors for literal unions with base & {} 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 of string/number/bigint, so you can have a string that 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.

Copilot AI balanced review requested due to automatic review settings September 21, 2026 17:52
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 21, 2026
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 21, 2026
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Sep 21, 2026
@github-project-automation github-project-automation Bot moved this from Not started to Done in PR Backlog Sep 21, 2026
@github-project-automation github-project-automation Bot moved this from Done to Not started in PR Backlog Sep 21, 2026
@weswigham
Wesley Wigham (weswigham) changed the base branch from main to weswigham/negated-types September 21, 2026 18:01
@weswigham
Wesley Wigham (weswigham) added this pull request to stack #64377 September 21, 2026 18:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 High severity · 2 Medium severity

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 thread tsc/internal/checker/checker.go Outdated
Comment on lines +22182 to +22183
if c.isNonNullishUnknownType(t) {
return c.emptyObjectType
Comment thread tsc/testdata/baselines/reference/compiler/narrowingTypeofUndefined2.types Outdated
@weswigham

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) test top1000

@typescript-automation

Copy link
Copy Markdown
Contributor

Hey Wesley Wigham (@weswigham), this PR changed while I was preparing the test run. Please try again.

@weswigham
Wesley Wigham (weswigham) force-pushed the weswigham/negated-types-empty-object-meaning branch 2 times, most recently from 8948e20 to 20e1202 Compare September 22, 2026 17:57
@weswigham

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) test top1000

@typescript-automation

typescript-automation Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top1000 ✅ Started

@weswigham
Wesley Wigham (weswigham) force-pushed the weswigham/negated-types-empty-object-meaning branch from 20e1202 to 34c043a Compare September 22, 2026 19:45
@weswigham
Wesley Wigham (weswigham) removed this pull request from stack #64377 September 28, 2026 20:27
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
@weswigham
Wesley Wigham (weswigham) force-pushed the weswigham/negated-types-empty-object-meaning branch from 34c043a to f8456b1 Compare October 19, 2026 16:34
@weswigham

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) test this

@typescript-automation

typescript-automation Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top400 ✅ Started
user test this ✅ Started
run dt ✅ Started ❌ Results
perf test this faster ✅ Started 👀 Results

@typescript-automation

Copy link
Copy Markdown
Contributor

Wesley Wigham (@weswigham)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - native
Errors 41 41 ~ ~ ~ p=1.000 n=12
Symbols 115,281 115,368 +87 (+ 0.08%) ~ ~ p=0.000 n=12
Types 80,284 81,343 +1,059 (+ 1.32%) ~ ~ p=0.000 n=12
Memory Used 114,762k (± 0.07%) 114,848k (± 0.04%) ~ 114,760k 115,023k p=0.139 n=12
Memory Allocs 2,219,704 (± 0.01%) 2,221,189 (± 0.00%) +1,485 (+ 0.07%) 2,221,046 2,221,440 p=0.000 n=12
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.040s (± 6.35%) 0.039s (± 3.57%) ~ 0.036s 0.042s p=0.808 n=12
Bind Time 0.013s (±10.62%) 0.014s (± 7.90%) ~ 0.011s 0.017s p=0.137 n=12
Check Time 0.551s (± 0.67%) 0.568s (± 0.59%) +0.017s (+ 3.12%) 0.560s 0.578s p=0.000 n=12
Emit Time 0.274s (± 2.07%) 0.280s (± 1.57%) ~ 0.262s 0.288s p=0.080 n=12
Total Time 0.884s (± 0.66%) 0.908s (± 0.63%) +0.024s (+ 2.69%) 0.889s 0.925s p=0.000 n=12
angular-1 - native
Errors 3 3 ~ ~ ~ p=1.000 n=12
Symbols 846,111 (± 0.05%) 847,592 (± 0.08%) +1,481 (+ 0.18%) 846,141 850,154 p=0.000 n=12
Types 249,046 (± 0.00%) 248,509 (± 0.00%) -537 (- 0.22%) 248,507 248,512 p=0.000 n=12
Memory Used 598,918k (± 0.04%) 598,586k (± 0.02%) -332k (- 0.06%) 598,288k 599,042k p=0.014 n=12
Memory Allocs 13,155,609 (± 0.09%) 13,177,088 (± 0.13%) +21,479 (+ 0.16%) 13,162,531 13,236,176 p=0.001 n=12
Config Time 0.017s 0.017s ~ ~ ~ p=1.000 n=12
Parse Time 0.229s (± 2.08%) 0.225s (± 2.01%) ~ 0.216s 0.241s p=0.352 n=12
Bind Time 0.068s (± 9.04%) 0.073s (±15.34%) ~ 0.058s 0.108s p=0.787 n=12
Check Time 0s 0s ~ ~ ~ p=1.000 n=12
Emit Time 1.571s (± 2.21%) 1.572s (± 1.59%) ~ 1.518s 1.652s p=0.966 n=12
Total Time 1.900s (± 1.91%) 1.903s (± 1.46%) ~ 1.837s 1.966s p=0.965 n=12
mui-docs - native
Errors 11,408 11,423 +15 (+ 0.13%) ~ ~ p=0.000 n=12
Symbols 4,336,502 5,298,865 🔻+962,363 (+22.19%) ~ ~ p=0.000 n=12
Types 1,378,064 1,299,077 🟩-78,987 (- 5.73%) ~ ~ p=0.000 n=12
Memory Used 2,634,908k (± 0.06%) 2,873,853k (± 0.05%) 🔻+238,945k (+ 9.07%) 2,870,504k 2,878,410k p=0.000 n=12
Memory Allocs 27,765,135 (± 0.07%) 30,975,128 (± 0.06%) 🔻+3,209,993 (+11.56%) 30,935,429 31,025,986 p=0.000 n=12
Config Time 0.017s 0.017s ~ ~ ~ p=1.000 n=12
Parse Time 0.472s (± 2.33%) 0.465s (± 2.27%) ~ 0.435s 0.490s p=0.504 n=12
Bind Time 0.002s 0.002s ~ ~ ~ p=1.000 n=12
Check Time 7.268s (± 0.44%) 7.815s (± 0.37%) 🔻+0.547s (+ 7.53%) 7.681s 7.862s p=0.000 n=12
Emit Time 0.577s (±11.47%) 0.428s (± 1.96%) 🟩-0.149s (-25.84%) 0.421s 0.470s p=0.001 n=12
Total Time 9.089s (± 0.70%) 9.472s (± 0.38%) 🔻+0.383s (+ 4.22%) 9.315s 9.547s p=0.000 n=12
strada-build-src - native
Errors 2 8 🔻+6 (+300.00%) ~ ~ p=0.000 n=12
Symbols 1,508,894 1,639,184 🔻+130,290 (+ 8.63%) ~ ~ p=0.000 n=12
Types 448,523 457,444 +8,921 (+ 1.99%) ~ ~ p=0.000 n=12
Memory Used 1,787,416k (± 0.37%) 1,936,515k (± 0.25%) 🔻+149,099k (+ 8.34%) 1,925,039k 1,946,102k p=0.000 n=12
Memory Allocs 79,302,744 (± 0.03%) 80,517,091 (± 0.03%) +1,214,347 (+ 1.53%) 80,479,386 80,582,088 p=0.000 n=12
Config Time 0.004s (±11.29%) 0.007s (± 6.39%) 🔻+0.002s (+49.06%) 0.005s 0.007s p=0.000 n=12
Parse Time 0.342s (± 2.27%) 0.370s (± 1.16%) 🔻+0.029s (+ 8.34%) 0.363s 0.385s p=0.000 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.752s (± 0.29%) 1.795s (± 0.39%) +0.043s (+ 2.47%) 1.779s 1.811s p=0.000 n=12
Emit Time 0.340s (± 2.43%) 0.336s (± 2.53%) ~ 0.321s 0.358s p=0.504 n=12
Total Time 21.454s (± 0.36%) 22.145s (± 0.72%) +0.690s (+ 3.22%) 21.757s 22.541s p=0.000 n=12
strada-compiler - native
Errors 1 2 🔻+1 (+100.00%) ~ ~ p=0.000 n=12
Symbols 335,152 335,189 +37 (+ 0.01%) ~ ~ p=0.000 n=12
Types 202,150 205,467 +3,317 (+ 1.64%) ~ ~ p=0.000 n=12
Memory Used 254,625k (± 0.03%) 255,125k (± 0.02%) +500k (+ 0.20%) 254,904k 255,304k p=0.000 n=12
Memory Allocs 4,364,309 (± 0.01%) 4,382,433 (± 0.01%) +18,124 (+ 0.42%) 4,381,254 4,383,726 p=0.000 n=12
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=12
Parse Time 0.117s (± 2.41%) 0.114s (± 4.16%) ~ 0.101s 0.123s p=0.467 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.047s (± 0.37%) 1.067s (± 0.30%) +0.020s (+ 1.88%) 1.060s 1.078s p=0.000 n=12
Emit Time 0.149s (± 4.84%) 0.159s (± 3.95%) 🔻+0.010s (+ 6.54%) 0.143s 0.174s p=0.043 n=12
Total Time 1.371s (± 0.74%) 1.403s (± 0.67%) +0.033s (+ 2.39%) 1.374s 1.429s p=0.000 n=12
ts-pre-modules - native
Errors 87 88 +1 (+ 1.15%) ~ ~ p=0.000 n=12
Symbols 304,478 304,722 +244 (+ 0.08%) ~ ~ p=0.000 n=12
Types 185,043 187,521 +2,478 (+ 1.34%) ~ ~ p=0.000 n=12
Memory Used 221,740k (± 0.02%) 222,069k (± 0.03%) +330k (+ 0.15%) 221,880k 222,190k p=0.000 n=12
Memory Allocs 1,432,287 (± 0.02%) 1,443,612 (± 0.01%) +11,325 (+ 0.79%) 1,443,280 1,444,421 p=0.000 n=12
Config Time 0.000s (±217.90%) 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.103s (± 4.58%) 0.097s (± 4.60%) 🟩-0.006s (- 6.07%) 0.086s 0.109s p=0.043 n=12
Bind Time 0.040s (± 9.04%) 0.040s (± 8.21%) ~ 0.032s 0.048s p=0.744 n=12
Check Time 0.812s (± 0.89%) 0.839s (± 0.80%) +0.027s (+ 3.36%) 0.821s 0.852s p=0.000 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 0.969s (± 1.05%) 0.990s (± 0.76%) +0.021s (+ 2.13%) 0.975s 1.012s p=0.003 n=12
vscode - native
Errors 396 406 +10 (+ 2.53%) ~ ~ p=0.000 n=12
Symbols 12,422,934 12,442,560 +19,626 (+ 0.16%) ~ ~ p=0.000 n=12
Types 4,077,598 4,140,779 +63,181 (+ 1.55%) ~ ~ p=0.000 n=12
Memory Used 5,865,293k (± 0.02%) 5,874,976k (± 0.02%) +9,682k (+ 0.17%) 5,872,523k 5,878,925k p=0.000 n=12
Memory Allocs 59,487,511 (± 0.01%) 60,059,496 (± 0.04%) +571,985 (+ 0.96%) 60,033,042 60,161,851 p=0.000 n=12
Config Time 0.077s (± 0.42%) 0.077s (± 0.32%) ~ 0.076s 0.077s p=1.000 n=12
Parse Time 1.820s (± 2.58%) 1.842s (± 2.91%) ~ 1.727s 1.977s p=0.486 n=12
Bind Time 0.726s (±12.40%) 0.696s (±15.61%) ~ 0.505s 0.945s p=0.514 n=12
Check Time 15.567s (± 0.84%) 16.144s (± 0.94%) +0.577s (+ 3.71%) 15.856s 16.438s p=0.000 n=12
Emit Time 5.189s (± 7.13%) 5.474s (± 4.27%) ~ 4.639s 5.836s p=0.178 n=12
Total Time 23.470s (± 1.23%) 24.320s (± 0.80%) +0.850s (+ 3.62%) 23.688s 24.913s p=0.000 n=12
webpack - native
Errors 599 620 +21 (+ 3.51%) ~ ~ p=0.000 n=12
Symbols 1,399,742 1,401,549 +1,807 (+ 0.13%) ~ ~ p=0.000 n=12
Types 683,614 745,932 🔻+62,318 (+ 9.12%) ~ ~ p=0.000 n=12
Memory Used 898,368k (± 0.02%) 902,963k (± 0.02%) +4,595k (+ 0.51%) 902,632k 903,379k p=0.000 n=12
Memory Allocs 7,052,180 (± 0.02%) 9,078,023 (± 0.02%) 🔻+2,025,842 (+28.73%) 9,075,922 9,086,253 p=0.000 n=12
Config Time 0.009s 0.009s ~ ~ ~ p=1.000 n=12
Parse Time 0.311s (± 2.74%) 0.318s (± 3.40%) ~ 0.281s 0.342s p=0.224 n=12
Bind Time 0.076s (± 3.34%) 0.078s (± 5.88%) ~ 0.071s 0.099s p=0.786 n=12
Check Time 2.698s (± 0.51%) 3.961s (± 0.44%) 🔻+1.263s (+46.81%) 3.909s 3.992s p=0.000 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 3.130s (± 0.37%) 4.402s (± 0.45%) 🔻+1.272s (+40.63%) 4.339s 4.438s p=0.000 n=12
xstate-main - native
Errors 0 422 🔻+422 (+ ∞%) ~ ~ p=0.000 n=12
Symbols 1,060,990 1,087,234 +26,244 (+ 2.47%) ~ ~ p=0.000 n=12
Types 390,861 402,646 +11,785 (+ 3.02%) ~ ~ p=0.000 n=12
Memory Used 474,899k (± 0.02%) 520,827k (± 0.02%) 🔻+45,928k (+ 9.67%) 520,637k 521,223k p=0.000 n=12
Memory Allocs 4,229,822 (± 0.08%) 4,667,771 (± 0.09%) 🔻+437,949 (+10.35%) 4,654,524 4,678,246 p=0.000 n=12
Config Time 0.003s 0.003s ~ ~ ~ p=1.000 n=12
Parse Time 0.133s (± 3.01%) 0.140s (± 3.89%) 🔻+0.007s (+ 5.65%) 0.127s 0.154s p=0.029 n=12
Bind Time 0.049s (±16.62%) 0.044s (±13.15%) ~ 0.033s 0.061s p=0.338 n=12
Check Time 1.098s (± 0.79%) 1.267s (± 1.20%) 🔻+0.169s (+15.38%) 1.223s 1.307s p=0.000 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 1.290s (± 0.75%) 1.480s (± 1.13%) 🔻+0.190s (+14.73%) 1.438s 1.524s p=0.000 n=12
System info unknown
Hosts
  • native
Scenarios
  • Compiler-Unions - native
  • angular-1 - native
  • mui-docs - native
  • strada-build-src - native
  • strada-compiler - native
  • ts-pre-modules - native
  • vscode - native
  • webpack - native
  • xstate-main - native
Benchmark Name Iterations
Current pr 12
Baseline baseline 12

Developer Information:

Download Benchmarks

@typescript-automation

Copy link
Copy Markdown
Contributor

Hey Wesley Wigham (@weswigham), it looks like the DT test run failed. Please check the log for more details.

You can check the log here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

2 participants