-
-
Notifications
You must be signed in to change notification settings - Fork 302
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 type definitions for use in TypeScript #60
Conversation
Nice! this looks good to me except for two things:
Thanks for your work! (not a typescript user myself, but I bet this will help lots of others that are) |
Sounds good! I'll update this PR tomorrow to include those two things. |
@tbekolay made you collaborator. So once you make those changes an I reviewed them, please merge to master following this guide. Thanks. |
I made the requested changes in a fixup commit (ada4a6f) so you can see the diff. Before fast-forward merging, I will squash these two commits into one commit (we also avoid merge commits in our project, so these steps are familiar to me). |
LGTM, please merge to master. And sorry for the long delay |
BTW one thing I'm not a huge fan of is the code duplication in the update scripts. |
Yes, I agree this is not ideal. I'll merge for now, but I'll add reducing duplication to my todo list. |
Previously, brace did not work well in TypeScript because the existing type definitions for the Ace editor from DefinitelyTyped are written assuming a global "ace" variable, rather than being modular and thus importable like so: import * as ace from "brace"; Additionally, the changes that brace makes (mostly the acequire rename) are not reflected in those definitions. This commit adds a script to obtain the current type definitions from DefinitelyTyped and rewrite them in a similar way as the Ace source itself is rewritten in brace. The resulting type definitions are exposed to TypeScript through the "typings" key in package.json (though since they live in `index.d.ts`, they would usually be discovered automatically).
Thanks published as 0.9 |
Hello! Thanks for
brace
, it's been very useful in our application, which we build with webpack.We've recently ported over our codebase from raw JS to TypeScript, and found that the available type definitions don't work with brace out of the box. This commit adds definitions that work, generated by a similar process as brace uses to generate JS source (see the commit message for more details).
I chose to do this with a separate
update-ts.js
script exposed through an npmupdate-ts
command, but if you prefer I could instead add the contents ofupdate-ts.js
to the existingupdate.js
.Alternatively, if you'd prefer that type definitions live outside of this repository, I'm happy to make a separate repository for this. However, I'm submitting this PR first as it's nice to be able to
npm install brace
and have the type definitions automatically available without the extra step of downloading them withtypings
.