-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Out of ScopeThis idea sits outside of the TypeScript language design constraintsThis idea sits outside of the TypeScript language design constraints
Description
Consider the interface:
interface xyz {
num: 1
str: "ok"
}
Currently the following snippet generates a type error:
let foo: xyz = {}
My proposal is the whenever a variable is declared to contain only one possible value, that value should be assumed whenever the variable's value is not specified. So, the above snippet would then not generate an error, but this would:
let foo: xyz = { num: 2 }
This proposed feature will make it easier to write clearer and simpler TypeScript code.
Metadata
Metadata
Assignees
Labels
Out of ScopeThis idea sits outside of the TypeScript language design constraintsThis idea sits outside of the TypeScript language design constraints