Skip to content

Commit 86448ff

Browse files
committed
Normalize NoInferType
1 parent f94b780 commit 86448ff

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/compiler/checker.ts

+1
Original file line numberDiff line numberDiff line change
@@ -20101,6 +20101,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2010120101
type.flags & TypeFlags.UnionOrIntersection ? getNormalizedUnionOrIntersectionType(type as UnionOrIntersectionType, writing) :
2010220102
type.flags & TypeFlags.Substitution ? writing ? (type as SubstitutionType).baseType : getSubstitutionIntersection(type as SubstitutionType) :
2010320103
type.flags & TypeFlags.Simplifiable ? getSimplifiedType(type, writing) :
20104+
type.flags & TypeFlags.NoInfer ? (type as NoInferType).type :
2010420105
type;
2010520106
if (t === type) return t;
2010620107
type = t;

tests/baselines/reference/noInfer.errors.txt

+1-6
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ tests/cases/conformance/types/typeRelationships/typeInference/noInfer.ts(24,14):
88
Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; }'.
99
tests/cases/conformance/types/typeRelationships/typeInference/noInfer.ts(31,14): error TS2345: Argument of type '{}' is not assignable to parameter of type '{ foo: number; }'.
1010
Property 'foo' is missing in type '{}' but required in type '{ foo: number; }'.
11-
tests/cases/conformance/types/typeRelationships/typeInference/noInfer.ts(41,9): error TS2322: Type 'NoInfer<T>' is not assignable to type 'T'.
12-
'T' could be instantiated with an arbitrary type which could be unrelated to 'NoInfer<T>'.
1311

1412

15-
==== tests/cases/conformance/types/typeRelationships/typeInference/noInfer.ts (7 errors) ====
13+
==== tests/cases/conformance/types/typeRelationships/typeInference/noInfer.ts (6 errors) ====
1614
export declare function foo<T extends string>(a: T, b: NoInfer<T>): void
1715

1816
foo('foo', 'foo') // ok
@@ -74,9 +72,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/noInfer.ts(41,9):
7472

7573
get value(): T {
7674
return this._value; // ok
77-
~~~~~~~~~~~~~~~~~~~
78-
!!! error TS2322: Type 'NoInfer<T>' is not assignable to type 'T'.
79-
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'NoInfer<T>'.
8075
}
8176
}
8277
export class OkClass2<T> {

0 commit comments

Comments
 (0)