How to import `arktype` into a typescript project?
I do it like this:
However, I get an error:
I tried to specify path to
cjs
version, but it didn't work:
How to get it imported?15 Replies
Meh, tsconfig is the worst config I've seen
I needed to correct this:
"moduleResolution": "Node16"
=> "moduleResolution": "node"
Nah, it didn't change anything. Or rather - it broke TypeScript
So I don't have a solution right now on how to fix this issue
I don't understand why TS cannot load arktype
This is my current tsconfig.json
The referenced @tsconfig/node16/tsconfig.json:
This is what seems to fix the issue:
becasue I use babel anywayThis is so weird uggh CJS/ESM stuff is the worst
The package publishes build output for both CJS and ESM and I haven't seen anyone else having this issue so off the top of my head no idea what specifically is causing this to happen for you
Also what is this why does package JSON have a million elipses before it 🤣
'....../package.json'.ts(1479)
@ssalbdivad could you please publish an "@typescript" branch on npm, especially for me?
I don't really ever have an actual need to use cjs or mjs as I always have a bundler, so I make my packages TS-only
(this would make sense to bun/deno users as well)
(There are points against this in general tho - https://gist.github.com/andrewbranch/6f11e6e0c3fb9a294590a061249264b0 )
Gist
tsc performance consuming .ts vs .d.ts files in npm packages
tsc performance consuming .ts vs .d.ts files in npm packages - tsc-ts-vs-dts.md
Tho I'd ask you to measure the perf
I used to have this for Deno. I've seen some of the .ts vs .d.ts stuff
Can you just use the repo?
I dunno
Can I pnpm install it?
Yeah you can point npm to a repo
Obviously it's not efficient but 🤷
But can you do that for monorepos?
Ackchually iirc there was a website to make those work
Hmm. I mean in alpha the main package was at the root level.
I mean beta, so.
There should be a straightforward-ish way to get it to work
Or a bunch of ways that are mildly straightforward
That don't involve me publishign something 😛 I wouldn't use that kind of dep for anything other than messing around though you don't want to install the website just to use a dependency
🤔
Having only es would be at least twice as simple as having cjs
But I'm not sure if telling peoples "install at@cjs if you need that 💩" is good or not
That idea has crossed my mind
I think the beta setup using tsup is fine though hopefully we'll see
it's just a <snip> 🙂