-
-
Notifications
You must be signed in to change notification settings - Fork 372
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 type defs #147
Comments
I'm using it in a TypeScript project right now, using Rollup to bundle it. I import it exactly as you've commented above and it works fine. Yes, it is missing TS definitions, but that doesn't stop it being used. It just means you have to do things the old-way and consult the examples / source / docs, rather than rely on code-insight. |
if someone wanted to contrib a type defs file, i'd gladly answer any pertinent api questions, though i would not be qualified to review it extensively, since i'm not typically in TS. this is especially true if the types are made extra terse/DRY through generics and multiple layers of indirection. |
Alright, now importing with For now, I guess this is an ok solution, but I do believe typings would be very useful. I am not well versed enough in Typescript to create declarations, although if I manage I'll gladly submit a PR. |
Strange, I didn't have to create a module at all. VSCode happily let me carry on with an implicit From what I've seen of the codebase so far, creating TS defs will be quite tricky. The function calls are easy enough, but the configuration options are vast. Probably worth waiting for the API / configs to settle down a bit before starting this imho. |
indeed, this will not be a quick 1-hour job, but not terribly daunting either. if my TS-foo was better, i'd do it myself, but there are only so many unpaid hours in a day i want to dedicate to side projects.
1.0.0 was tagged last night, so the API & opts are pretty much settled. there are some extra callback args in places that i'd prefer to under-document so i can break them without upsetting semver, but those are a tiny minority. a good place to start is to browse #48 and inspect a uPlot instance - it re-exposes the majority of its opts (after merging default opts with user opts) and should be a pretty thorough scaffold for typedefs. |
I am using WebStorm and I have an ESlint configuration that disallows implicit |
If this is not being written already, I can give this a shot over the weekend, been using TypeScript daily |
yeah, any help would be appreciated. i've been trying to find a simple template on https://github.com/DefinitelyTyped/DefinitelyTyped to start with, but they are all so different based on how libs export stuff that i could not isolate much in common. e.g. some have namespaces, others don't. some have multiple files and are very verbose with comments, others have some default file that exports just the lib name 🤷♂ |
I added some initial types in a PR I created |
thanks @fluxin! i'm currently on vacation, but i'll review your PR in the next few days. |
I modified and added the types of @fluxin to DefinitelyTyped, for now, to use uPlot in a TS project: DefinitelyTyped/DefinitelyTyped#43250. Feel free to remove the definitions again when your repo provides their own. |
Sorry for not being more clear on the initial commit. I've never made a
definition file before and only spent about an hour trying to figure it
out. So I would not consider it complete or fully correct. Just useable
based on features I personally used in a project.
I just hope it would be a good baseline for someone to start with.
…On Thu, Mar 19, 2020, 6:28 PM Leon Sorokin ***@***.***> wrote:
hey @leolabs <https://github.com/leolabs>, i would prefer that you close
that PR.
there are a good amount of inaccuracies many omissions in #153
<#153>, which i'm working through right
now <#153 (comment)>.
i expect the proper types to land in a day or two.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#147 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAWBLETFVB6QJCRYMOBQTRIKTAFANCNFSM4LFDQJWA>
.
|
alright, folks. here it is! https://github.com/leeoniya/uPlot/blob/master/dist/uPlot.esm.d.ts improvements and/or corrections are welcome. |
This seems to be a pretty efficient and amazing library.
Unfortunately I have been unable to successfully use it in my application with Vue.js using Typescript.
The library lacks type declarations, and in general lacks the ability to be imported (e.g. with an ES6 import,
import uPlot from 'uplot';
) and used programmatically to render a chart.Are there plans to create type declarations for the library?
Without them, the library is more or less unusable in any modern JS framework.
The text was updated successfully, but these errors were encountered: