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
{{ message }}
This repository was archived by the owner on Feb 23, 2023. It is now read-only.
numbers: Add proper safety to operator overloading (#204)
* numbers: Add null assertions to operator overloading
When operator overloading functions are called, then unfortunately
work when the left hand side of the operation is nullable (only inside
class properties), like this:
```ts
class BigInt extends Uint8Array {
@operator('+')
plus(other: BigInt): BigInt {
// ...
}
}
class Wrapper {
public constructor(
public n: BigInt | null
) {}
}
let x = BigInt.fromI32(2);
let y: BigInt | null = null;
// x + y; // give compile time error about nullability
let wrapper = new Wrapper(y);
wrapper.n = wrapper.n + x; // doesn't give compile time errors as it should
```
In our case it would break in graph-node's runtime side because these
operator implementations are written there in the host-exports.
These checks only exist while the compiler doesn't catch this itself.
* 0.22.0-alpha.3
0 commit comments