Skip to content
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

Add TypeScript typings file for inclusion in TypeScript projects #104

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add TypeScript typings file for inclusion in TypeScript projects #104

wants to merge 2 commits into from

Conversation

NZSmartie
Copy link

Created a typings file based on the exposed functions defined in README.md

The functions are not annotated with JSDoc yet, this was just enough to compile
and run in a RequireJS environment

Created a typings file based on the exposed functions defined in README.md

The functions are not annotated with JSDoc yet, this was just enough to compile
and run in a RequireJS environment
@bgrins
Copy link
Owner

bgrins commented Sep 17, 2015

Hi @NZSmartie, thanks for the PR. What's the process for keeping these up to date? Would it be possible to auto generate this file if we had JSDoc annotations in the code?

@NZSmartie
Copy link
Author

Generating a TypeScript .d.ts file from javascript isn't really possible, jQuery for example is all hand crafted.

However, if tinycolor was written in TypeScript and compiled down to .js, a --declarations parameter can be passed to tsc to produce a .d.ts file along side the .js file

@NZSmartie
Copy link
Author

Overlooked how some functions were implemented in the tinycolor namespace, so moved functions to the declare ... var tinycolor object.

I'm still testing features on it and fixing mistakes as I go

@SidIcarus
Copy link

@bgrins, @NZSmartie
A typings file, d.ts, can now be generated from javascript files via JSDocs via a tsconfig given the configurations of

{
  allowJs: true,
  declarations: true,
}

I think

@braebo
Copy link

braebo commented Jan 15, 2023

Types are imperative for Javascript projects too. If there are no types shipped with this library, they should at least be published to Definitely Typed.

Ultimately though, this library should be converted to typescript ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants