-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
Description
TypeScript Version: 3.3.0-dev.20181229
Search Terms:
- conditional types
- lookup
- broken
Code
export interface PassthroughProps<
DataType extends {[key: string]: any},
DataTypeKey extends string = Extract<keyof DataType, string>,
IdentityCandidate extends DataTypeKey = DataType[IdentityCandidate] extends string
? IdentityCandidate
: never,
> {
identityProperty: IdentityCandidate;
label: DataTypeKey | ((option: DataType) => string);
}
interface MyType {
id: string;
name: string;
times: number;
}
const myprops: PassthroughProps<MyType> = {
// ITEM 1
identityProperty: "times",
label: "id",
};
Expected behavior:
Item 1
I'm expecting identityProperty
to be ( "id" | "name" )
, not never
.
Actual behavior:
Item 1
I'm getting this error:
Type 'string' is not assignable to type 'never'.ts(2322)
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code