Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Regression: Argument of type ... is not assignable to parameter of type ... #29505

Copy link
Copy link
@asfernandes

Description

@asfernandes
Issue body actions

This were working without error in TypeScript 3.0.1 but is not working on 3.2.4.

The select function is intended to accept only property names of type string in the last argument, but in 3.2.4 it does not accept any string.

It gives error: [ts] Argument of type '"value"' is not assignable to parameter of type 'XX extends XX ? "value" : never'. [2345]

export type FilterPropsByType<T, TT> = {
	[K in keyof T]: T[K] extends TT ? K : never
}[keyof T];

function select<
	T extends string | number,
	TList extends object,
	TValueProp extends FilterPropsByType<TList, T>
>(
	property: T, list: TList[], valueProp: TValueProp
)
{
	//
}

export function func<XX extends string>(x: XX, tipos: { value: XX }[]) {
	select(x, tipos, 'value');
}
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.