You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Strings are Immutable at runtime, but only (strictly speaking) ReadonlyDeep at compile time.
As so often, the cause is method syntax, in particular:
interfaceRelativeIndexable<T>{/** * Takes an integer value and returns the item at that index, * allowing for positive and negative integers. * Negative integers count back from the last item in the array. */at(index: number): T|undefined;}
Observe:
constfoo="hello";// This compiles but throws at runtime// eslint-disable-next-line functional/no-expression-statements, functional/immutable-data, functional/functional-parametersfoo.at=()=>"";
It would be nice (if extremely low priority) if this could be caught at compile time, before linting and certainly before runtime.
The text was updated successfully, but these errors were encountered:
exporttypeImmutableString=ImmutableShallow<string>;constfoo: ImmutableString="";// No longer compiles: Cannot assign to 'at' because it is a read-only property. ts(2540)// eslint-disable-next-line functional/no-expression-statements, functional/immutable-data, functional/functional-parametersfoo.at=()=>"";
Strings are Immutable at runtime, but only (strictly speaking) ReadonlyDeep at compile time.
As so often, the cause is method syntax, in particular:
Observe:
It would be nice (if extremely low priority) if this could be caught at compile time, before linting and certainly before runtime.
The text was updated successfully, but these errors were encountered: