-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat(typescript): improve declarations #541
Conversation
thanks. this fixes a few outstanding bugs so I've released 14.0.2 with it. @Saul-Mirone is there some reason that we shouldn't copy the DefinitelyTyped types in their entirety to the twemoji repo? theoretically, they should be the same types IMO. |
* @param options all info for this parsing operation | ||
* @param variant the optional \uFE0F ("as image") variant, in case this info is anyhow meaningful. By default this is ignored. | ||
*/ | ||
declare type ParseCallback = (icon: string, options: object, variant: string) => string | false; |
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.
shouldn't the type of options stay TwemojiOptions
instead of 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.
Why is this object
?
* | ||
* @param utf16surrogatePairs string generic utf16 surrogates pair, i.e. \uD83D\uDCA9 | ||
* @param sep string optional separator for double code points, default='-' | ||
* @return string utf16 transformed into codepoint, i.e. '1F4A9' |
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 JSDoc, types must be wrapped in curly braces (and for @param
, the type should come before the name)
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.
It's not JSDOC, it's tsdoc
I don't think there's any problem for us to copy it. But I want to leave it to you to decide. |
Copy some code from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/twemoji/index.d.ts
to make d.ts declaration better for twemoji.
Respect to the community works. 🙇