Include type assertion utils in std library
It would be handy to have a standard way of writing type assertions. Main use-case is to check typings that you add on top of node module.
Examples of type assertion utils that I like:
Lib https://github.com/type-challenges/type-challenges/blob/main/utils/index.d.ts Usage https://github.com/type-challenges/type-challenges/blob/main/utils/index.d.test.ts
Lib https://github.com/TypeStrong/ts-expect/blob/master/src/index.ts Usage https://github.com/TypeStrong/ts-expect/blob/master/src/index.spec.ts Or in my PR (temporally included it from raw) https://github.com/denoland/deno_std/pull/2111/files#diff-e03f76ef798baccc36a2d182d5a954a6567fb7a18c9707a9cc8763c360759fe5R65
There's also conditional-type-checks by @dsherret
@kt3k I like those utils done by @dsherret, do we want to add them as dependency and reexport or should we include their copy to std after asking the author if they will be okay with that?
@Duelsik We should include the copy of them with copyright attribution in the file header (In principle, std shouldn't depend on any external deps. ref: https://github.com/denoland/deno_std#deno-standard-modules). Copying is ok without authors' permission because they are licensed under MIT.
@Duelsik We should include the copy of them with copyright attribution in the file header (In principle, std shouldn't depend on any external deps. ref: https://github.com/denoland/deno_std#deno-standard-modules). Copying is ok without authors' permission because they are licensed under MIT.
Thank you @kt3k, not sure if I did everything correctly, but did a PR that copies essential code from https://github.com/dsherret/conditional-type-checks, I've tried to infer how to put proper headers from nodes mjs file - comments are very welcome, I feel very new to copy-pasting code between repos :)
@kt3k this issue should probably be closed now that #2864 landed?