-
-
Notifications
You must be signed in to change notification settings - Fork 113
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 #153
Conversation
`ParseOptions`: Add `customTags` and deprecate `tags` to get rid of following warning in console: `(node:15352) DeprecationWarning: The option 'tags' will be removed in a future release, use 'customTags' instead.`
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.
I tested it in prettier/yaml-unist-parser@d999748, it looks good but it seems you forgot to add files: ["*.d.ts"]
in package.json
.
Some of the interface and namespaces are available from different names and endpoints compared to before
I'd recommend to export all the used types. For example, index.d.ts
exports parseCST
from parse-cst.d.ts
so all the types that are related to parseCST
would be better to be re-exported to index.d.ts
as well.
/** | ||
* Used by some tags to configure their stringification, where applicable. | ||
*/ | ||
options?: object |
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.
Should we define interface for these options?
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.
This needs to be extendable by custom tags, each of which will have their own options shape. I'm not sure what specifying this further would really help?
Co-Authored-By: Ika <ikatyang@gmail.com>
@ikatyang I added re-exports of the |
Fixes #102
Fixes DefinitelyTyped/DefinitelyTyped#33780
Closes DefinitelyTyped/DefinitelyTyped#43450
Related: #23, #47
These types are based on those published as
@types/yaml
, which are mostly the work of @ikatyang, with contributions from @ColinBradley and @shirk3y. In fact, I've picked out the original commits from DefinitelyTyped into this branch, and worked from there.I'm relatively confident about these types, though I've not tested them very deeply. There are a few changes that may be relevant:
Iterable
, possibly a bit later than that.The
tsconfig.json
andyaml-tests.ts
files are remnants of the DT history, and should probably get removed before merging this.Comments are very welcome here, in particular wrt changes to the DT types. For example, if there's reason to do so, re-exports could be added to match the previous typings.