agiledigital / agiledigital/readonly-types
immutable string
- 主要語言
- TypeScript
- 星號
- 17
- 分支
- 2
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Strings are Immutable at runtime, but only (strictly speaking) ReadonlyDeep at compile time.
As so often, the cause is method syntax, in particular:
```typescript
interface RelativeIndexable {
/**
* 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:
```typescript
const foo = "hello";
// This compiles but throws at runtime
// eslint-disable-next-line functional/no-expression-statements, functional/immutable-data, functional/functional-parameters
foo.at = () => "";
```
It would be nice (if extremely low priority) if this could be caught at compile time, before linting and certainly before runtime.
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。