Closed as not planned
Description
π Search Terms
incorrect type, incorrect value
π Version & Regression Information
TypeScript version: 5.4.5
β― Playground Link
π» Code
const CounterSymbol = Symbol('CounterSymbol');
type Counter = 0 | number & { [CounterSymbol]: true };
// This manual assertion is correct. Sense of this type is impossibility of misc changes.
const intInc = (counter: Counter): Counter => (counter + 1) as Counter;
let counter: Counter = 0;
counter = 3;
counter = counter - 100; // must be error but no, thus it's the leak in typization
counter -= 100; // must be error but no, thus it's the leak in typization
class A {
protected counter: Counter = 0;
public inc(): void {
this.counter = counter - 100;
this.counter -= 100; // must be error but no, thus it's the leak in typization
}
}
π Actual behavior
Assignation was allow
π Expected behavior
Assignation was deny
Additional information about the issue
No response