Search Terms
readonly without type
Suggestion
Today, in order to use a readonly type with inference you need to know typeof exists
const user = {
name: "orta"
}
const readonlyUsers: readonly typeof user[] = [user]
It would be nice to support shorthand syntax for this:
const user = {
name: "orta"
}
const readonlyUsers: readonly = [user]
Where the lack of a definition outside of readonly implies you want to keep the inferred type.
Use Cases
Making it cheaper syntactically to use readonly more often without using slightly more esoteric typescript features.
Could be negated by these though:
Checklist
My suggestion meets these guidelines:
Search Terms
readonly without type
Suggestion
Today, in order to use a readonly type with inference you need to know
typeofexistsIt would be nice to support shorthand syntax for this:
Where the lack of a definition outside of
readonlyimplies you want to keep the inferred type.Use Cases
Making it cheaper syntactically to use
readonlymore often without using slightly more esoteric typescript features.Could be negated by these though:
Checklist
My suggestion meets these guidelines: