Skip to content

Commit

Permalink
Normalize NoInferType
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Feb 25, 2023
1 parent f94b780 commit 86448ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 1 addition & 6 deletions tests/baselines/reference/noInfer.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'NoInfer<T>'.


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

foo('foo', 'foo') // ok
Expand Down Expand Up @@ -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<T>' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'NoInfer<T>'.
}
}
export class OkClass2<T> {
Expand Down

0 comments on commit 86448ff

Please sign in to comment.