better-typescript-lib
better-typescript-lib copied to clipboard
Better TypeScript standard library
- Fix #15 - Found a more beautiful way to write the return type of `Object.assign` - Let methods with `CheckNonNullable` raise an error instead of returning `never` - Check...
https://github.com/microsoft/TypeScript/blob/main/tests/cases/conformance/functions/strictBindCallApply1.ts **Fix:** ```diff --- es5.d.ts +++ es5.d.ts interface CallableFunction extends Function { @@ @@ + /** + * For a given function, creates a bound function that has the same...
I was reading the discussion at https://github.com/microsoft/TypeScript/issues/15048 and noticed that the definition of `Number.isInteger` from this library has the mentioned type guard, `number is number`. To summarize the problem: When...
In #4 it was suggested to improve the typing to `this is this & Record` but https://github.com/uhyo/better-typescript-lib/commit/b86460065acbd1a511631e668205b41b1e47946c seems to have set it to something closer to `this is {}` instead....
The standard TypeScript type requires the first argument of the includes function to be a value in an array. This requires that the type of the argument be known beforehand...
`structuredClone`についてこの型定義ライブラリでオーバーライドされていると便利かなと思うのですがいかがでしょうか?標準ライブラリのそれは今の所`(val: T, options?: StructuredSerializeOptions): T`というシグネチャになっており、うっかりすると実行時エラーを引き起こしそうです (例えば殆どのクラスはコンストラクタの情報を暗に持つためシリアライズできず、例外が起きます)。 提案するだけでは忍びないので実際にたたき台を作ってみました。継承が保存されずに親クラスに弱化されることに注意すると読みやすいと思います。 ```ts type StructuredCloneOutput = T extends never ? never : /* T extends EvalError // TS is not nominal... // ? EvalError :*/...
Currently, the return value of `Object.entries` is [string, V], which is weakly typed when extracted by subsequent `map`, etc. Therefore, we propose to return [K,V] so that the type of...
Hi, great project! I think one way to make it even better would be some clarification on use cases. I read through the document and the `JSON.parse` example is good...
I was wondering if I should use better-typescript-lib or https://github.com/total-typescript/ts-reset, or both. Would be great to have a comparison in the README.
[TS Playground](https://www.typescriptlang.org/play/?target=99&ts=5.4.5#code/JYOwLgpgTgZghgYwgAgPICMBWEFgMID2IAzmFAK64FTIDeAUMk8gG5wA25ExAPANLIIAD0ggAJsWQAFKAQAO0MAE8+EJQBpkANQB8ACgIAuZACUc1Mf026AlMa0BtALoBuegF969dhDDIAtkoYmMYEWDh+ALx07m70CESkrBxcktHBEQB0bJzceoHBNm5AA) As shown above, this overload included in better-typescript-lib cause an issue when applied to an object without a specified key or value type. The overload seems to match...