diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index af0fde026d5c1..3aef51897beac 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20101,6 +20101,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { type.flags & TypeFlags.UnionOrIntersection ? getNormalizedUnionOrIntersectionType(type as UnionOrIntersectionType, writing) : type.flags & TypeFlags.Substitution ? writing ? (type as SubstitutionType).baseType : getSubstitutionIntersection(type as SubstitutionType) : type.flags & TypeFlags.Simplifiable ? getSimplifiedType(type, writing) : + type.flags & TypeFlags.NoInfer ? (type as NoInferType).type : type; if (t === type) return t; type = t; diff --git a/tests/baselines/reference/noInfer.errors.txt b/tests/baselines/reference/noInfer.errors.txt index d04b849d24b34..cc01a35e69171 100644 --- a/tests/baselines/reference/noInfer.errors.txt +++ b/tests/baselines/reference/noInfer.errors.txt @@ -8,11 +8,9 @@ tests/cases/conformance/types/typeRelationships/typeInference/noInfer.ts(24,14): Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; }'. tests/cases/conformance/types/typeRelationships/typeInference/noInfer.ts(31,14): error TS2345: Argument of type '{}' is not assignable to parameter of type '{ foo: number; }'. Property 'foo' is missing in type '{}' but required in type '{ foo: number; }'. -tests/cases/conformance/types/typeRelationships/typeInference/noInfer.ts(41,9): error TS2322: Type 'NoInfer' is not assignable to type 'T'. - 'T' could be instantiated with an arbitrary type which could be unrelated to 'NoInfer'. -==== tests/cases/conformance/types/typeRelationships/typeInference/noInfer.ts (7 errors) ==== +==== tests/cases/conformance/types/typeRelationships/typeInference/noInfer.ts (6 errors) ==== export declare function foo(a: T, b: NoInfer): void foo('foo', 'foo') // ok @@ -74,9 +72,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/noInfer.ts(41,9): get value(): T { return this._value; // ok - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'NoInfer' is not assignable to type 'T'. -!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'NoInfer'. } } export class OkClass2 {