Search Terms
readonly symbol property
Suggestion
Expose isReadonlySymbol as a method on TypeChecker.
Currently there's no way to tell for sure if a property is readonly.
While cumbersome userland implementations can check for readonly modifier in Symbol.declarations, if it's a GetAccessor without corresponding SetAccessor or if it originated in Object.definePropery(this, 'propName', {value, writable: false}).
However, there's one more thing: Readonly mapped type only sets Symbol.checkFlags which is internal.
So at the very least I need an API to tell if a property's symbol comes from a mapped type with a readonly modifier.
/cc Christian Schulz (@CSchulz) you probably need the same API for the lint rule you want to develop.
Search Terms
readonly symbol property
Suggestion
Expose
isReadonlySymbolas a method onTypeChecker.Currently there's no way to tell for sure if a property is readonly.
While cumbersome userland implementations can check for
readonlymodifier inSymbol.declarations, if it's a GetAccessor without corresponding SetAccessor or if it originated inObject.definePropery(this, 'propName', {value, writable: false}).However, there's one more thing:
Readonlymapped type only setsSymbol.checkFlagswhich is internal.So at the very least I need an API to tell if a property's symbol comes from a mapped type with a
readonlymodifier./cc Christian Schulz (@CSchulz) you probably need the same API for the lint rule you want to develop.