-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
Domain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone

Description
TypeScript Version: 3.1.0-dev.20180810
Code
interface IceCreamOptions {
readonly cherry: "yes" | "no"
}
declare function iceCream(options: IceCreamOptions): void;
const options = { cherry: "yes" };
iceCream(options);
Expected behavior:
Error message recommending to add a type annotation to options
. This should be detectable because the source of the failing property is a PropertyAssignment
in an object literal being assigned to a variable. (If there is no variable assignment, we could still recommend using ``"yes" as "yes"although that isn't as pretty.) Could also come with a codefix. Note that in JS the fix is slightly different: put
/** @type {IceCreamOptions} /` before the `const` or use `/* @type {"yes"} */ ("yes")`.
Actual behavior:
Error messages says Type 'string' is not assignable to type '"yes" | "no"'.
with no information on how to fix it.
Metadata
Metadata
Assignees
Labels
Domain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript