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 #8
Conversation
index.d.ts
Outdated
*/ | ||
declare function readPkg(options?: IOptions): Promise<IPackage>; | ||
|
||
declare namespace readPkg { |
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.
In TS 3.1, we can now declare props on functions, so I don't think we need a namespace for this, see: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html
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'm trying to get this style of definition to work, but I'm not sure how to translate their example (which is for a regular .ts file) to work with a definition file with an ambient context, where you can't make assignments.
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.
Hmm, I think you're right. Actually, we can just export the sync
method as a named export.
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.
Are you talking about like so?
export default function (options?: Options): Promise<PackageMetadata>;
export function sync (options?: Options): PackageMetadata;
I believe that would require a change to the JS if that's the plan.
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.
Yup, exactly like that.
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.
Alright, I think this is done too.
Very nice work. Thanks for taking the time to make it great. 🙌 |
|
You still need to do #8 (comment) |
@dudeofawesome Ping :) |
@dudeofawesome Still interested in finishing this? :) |
No description provided.