-
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
π Search Terms
setter only
π Version & Regression Information
- This is the behavior in every version I tried, from 5.7.3 down to 3.3.3333
β― Playground Link
π» Code
const language = {
set current(name: string) {
this.log.push(name);
},
log: [] as string[],
};
language.current = "FR";
const c = language.current;
π Actual behavior
Variable c
is said to be of type string
.
π Expected behavior
As clearly stated here, it should be undefined
.
Note that
current
is not defined, and any attempts to access it will result inundefined
.
Additional information about the issue
No response
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