@mrsekut/utils
JSR
$ npx jsr add @mrsekut/utils
どのリポジトリでも用意する様なUtilityは一箇所にまとめる
毎回各所でコピペしたり修正したりテストを書いたりするのが面倒なので
#WIP
todos
なんか生成されている型がおかしいな
これに対して
code:ts
export const sortBy =
<T, R>(prop: (a: T) => R) =>
(a: T, b: T): number =>
prop(a) > prop(b) ? 1 : prop(b) > prop(a) ? -1 : 0;
こういう型が生成されている
code:ts
export declare const sortBy: <T, R>(prop: (a: T) => R) => any;
これ、どこのバグだろう?JSRの内部実装?
slow type周りかな
書いてた
The package will not be able to generate type declarations for the npm compatibility layer, or “slow types” will be omitted or replaced with any in the generated type declarations. ref
対処法がわからないmrsekut.icon
publishに--allow-slow-typesをつけても変わらなかった
ci
適当にコードを追加する
jotai-sync#6688fdda198270000072de62
Tree Shakableにする
https://kettanaito.com/blog/building-a-treeshakable-library-with-rollup
https://zenn.dev/nissy_dev/articles/how-to-make-tree-shakeable-libraries
https://blog.theodo.com/2021/04/library-tree-shaking/
@antfu/utils
https://github.com/antfu/utils/blob/main/rollup.config.js これ?
Tree Shakableであることを確認する