Closed ottomated closed 2 weeks ago
Typescript's intellisense lists every single function prototype property on runes:
This makes it difficult to see the actual useful properties (frozen, snapshot) and allows you to write things like
frozen
snapshot
$state.bind(this);
without Typescript complaining.
The type definitions can be updated like so:
declare const $state: { /** @deprecated */ apply: never; /** @deprecated */ arguments: never; /** @deprecated */ bind: never; /** @deprecated */ call: never; /** @deprecated */ caller: never; /** @deprecated */ length: never; /** @deprecated */ name: never; /** @deprecated */ prototype: never; /** @deprecated */ toString: never; <T>(initial: T): T; <T>(): T | undefined; frozen<T>(initial: T): Readonly<T>; frozen<T>(): Readonly<T> | undefined; snapshot<T>(state: T): T; };
which makes intellisense look like this:
with this tradeoff:
(note that I explored a few ways of achieving this and it seems fairly delicate)
would make my life easier
Pretty clever! Riffing off of this a bit, perhaps this could work too? REPL
Applying it to the namespace instead should curb the tradeoff issue altogether:
Describe the problem
Typescript's intellisense lists every single function prototype property on runes:
This makes it difficult to see the actual useful properties (
frozen
,snapshot
) and allows you to write things likewithout Typescript complaining.
Describe the proposed solution
The type definitions can be updated like so:
which makes intellisense look like this:
with this tradeoff:
(note that I explored a few ways of achieving this and it seems fairly delicate)
Importance
would make my life easier