-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TypeScript] full support β¨π€ #6
Conversation
β¦tting Implementing typescript to gemini class, chat class and coverage.
This is great π Hope it gets merged soon. |
tsconfig.json
Outdated
"baseUrl": ".", | ||
"inlineSourceMap": true, | ||
"inlineSources": true, | ||
"module": "ESNext", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS somewhat complains about this Option 'module' must be set to 'NodeNext' when option 'moduleResolution' is set to 'NodeNext
ts 5.3.3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do it, it changes resolution model from directory specification into file specification:
import {} from 'abc';
to:
import {} from 'abc.js';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, i've changed it to use nodenext directly. Try it on your build to verify it.
You may also want to remove the old |
vite.config.ts
Outdated
@@ -0,0 +1,16 @@ | |||
import { defineConfig } from 'vite'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately if using bun the cache likes to be tested, can remove it with config.
import { defineConfig } from 'vite'; | |
import { defineConfig } from 'vitest/config'; |
{
...
test: {
exclude: ['*/~/**']
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, great idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When running vitest with bun it just crashes in a fire.
I excluded the test from the config. so it does not catch fire
β¦ci, resolve build conflict in due to vitest/config - bun interaction
hey @EvanZhouDev can you merge this? I would love to have full typescript support on the official package. |
I might be dumb but how do you build and publish the package @Mimikkk? I've tried with npm publish and vite build but they don't seem to work. |
Hello @yoroshikun @kcoderhtml @Mimikkk, sorry for the super late response. I know most likely you're not using this package anymore, but I thought I'd still update you on what's going on. I've been extremely busy for the past few months on work and other projects, so I haven't been able to catch up with However, seeing as Google has released Gemini 1.5 Flash today, I will be coming back to this project. Expect a relatively large update in the next few weeks, featuring types, updated streaming support, as well as better support by default for the new models. As for this,
only the original publisher can update the package to NPM π |
Thanks! Looking forward to trying the updated package!
I believe I was trying to rebuild the package and deploy to my NPM account, but I can't remember at this point what I was trying to do :) |
I have finished the initial rewrite in TypeScript, which is now available on the Edit: PR now available at #9 |
Thank you!!! Looking forward to trying it out! |
Full TypeScript support, along with a bunch of great new features are now available on NPM. Will be closing this for now. Feel free to continue on this thread (or start a new issue) if anything needs to be fixed! |
I've been working for a couple of hours to add typescript support to the project.
It encompasses tests, utils and so on. Bumped vitest to 1.1.1 and did a few minor tweaks due to typing.
Changes:
typescript 5.3.3
support.vite
for building minified solution in both commonjs and esmodules formats.prettier
for code formatting.concurrently/rimraf/copyfiles
for support building on linux/windows/macos.vite
allowed me to split files intoutils
/types
andindex
for ease of developmentAdded scripts:
build
: builds the package into the build directory using vite. It clears thebuild/
directory, then it runs build process,build:clear
: clears thebuild/
directorybuild:types
: emits the typescript definitions into thebuild/
directorybuild:lib
: build and minifies the package into thebuild/
directoryI moved the dynamically created class
Chat
outside theGemini
class and added exported createGemini function for the ease of creation multiple instances.