Open
Description
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 @CSchulz you probably need the same API for the lint rule you want to develop.