add esm support
IamFive opened this issue · 4 comments
Can not Claude in esm project now, may you kindly add that.
I find there already has a define file, but seems not published to npm.
Claude already is ESM, you can import {Claude} from "claude-ai"
or import Claude from "claude-ai"
.
@Explosion-Scratch When i do it like you said, vscode alerts:
Could not find a declaration file for module 'claude-ai'. node_modules/.pnpm/claude-ai@1.2.0/node_modules/claude-ai/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/claude-ai` if it exists or add a new declaration (.d.ts) file containing `declare module 'claude-ai';`ts(7016)
and i checked the claude-ai folder, there are no declaration files. and my install is the latest version in npm.
I guess you have not publish the d.ts to npm, may you check that?
It now has JSDoc comments as well so it shouldn't even need the typescript declarations but I'll try to debug it a bit tomorrow
It now has JSDoc comments as well so it shouldn't even need the typescript declarations but I'll try to debug it a bit tomorrow
thanks, and if i copy the .d.ts in git repo to npm folder, the alert disappears.