-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
TypeScript Version: 3.5.1
Search Terms:
- Error message different
Code
interface ExprData {
mapper : () => unknown,
blah : string,
}
interface Expr<DataT extends ExprData> {
mapper : DataT["mapper"],
blah : DataT["blah"],
extra : number,
}
declare function where (
callback : () => Expr<{
mapper : () => boolean,
blah : string,
}>
) : void;
declare function getInvalidWhere () : Expr<{
mapper : () => (boolean|null),
blah : string,
}>;
/*
Type 'Expr<{ mapper: () => boolean | null; blah: string; }>' is not assignable to type 'Expr<{ mapper: () => boolean; blah: string; }>'.
Type '{ mapper: () => boolean | null; blah: string; }' is not assignable to type '{ mapper: () => boolean; blah: string; }'.
Types of property 'mapper' are incompatible.
Type '() => boolean | null' is not assignable to type '() => boolean'.
Type 'boolean | null' is not assignable to type 'boolean'.
Type 'null' is not assignable to type 'boolean'.
*/
where(() => getInvalidWhere())
/*
Expected: Same error as above,
Actual:
Type 'Expr<{ mapper: () => boolean | null; blah: string; }>' is not assignable to type
'Expr<{ mapper: () => boolean; blah: string; }>'.
*/
where(() => getInvalidWhere())
Expected behavior:
- Both errors should have the same error message, if they're in the same file.
- Both errors should have the same error message, if they're in different files.
Actual behavior:
- Both errors have different error messages in the same file.
- Both errors have different error messages in different files.
Playground Link:
Related Issues:
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScriptAn idea for TypeScript