Skip to content

Type alias substitution does not work #31616

Closed
@reverofevil

Description

@reverofevil

TypeScript Version: 3.5.0-dev.20190525

Search Terms:
type substitution is incorrect

Code

const v = { test: { smth: 5 } };
type Field<A extends string, R> = { [K in A]: R } | {}
const f = <A extends string, B extends string, R>(x: { [K in A]: Field<B, R> } | {}): R => ({} as any);
const g = <A extends string, B extends string, R>(x: Field<A, Field<B, R>>): R => ({} as any);
const r1 = f(v); // number
const r2 = g(v); // unknown

Expected behavior:
Both should be number.

Actual behavior:
unknown

Playground Link:
Link

Related Issues:
Nope.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolutionFix AvailableA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions