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

feat(typescript): improve declarations #541

Merged
merged 1 commit into from
Mar 31, 2022
Merged

feat(typescript): improve declarations #541

merged 1 commit into from
Mar 31, 2022

Conversation

Saul-Mirone
Copy link
Contributor

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. 🙇

@CLAassistant
Copy link

CLAassistant commented Mar 29, 2022

CLA assistant check
All committers have signed the CLA.

@jdecked
Copy link
Contributor

jdecked commented Mar 31, 2022

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;
Copy link

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 ?

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'
Copy link

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)

Copy link
Contributor Author

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

@Saul-Mirone
Copy link
Contributor Author

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.

I don't think there's any problem for us to copy it. But I want to leave it to you to decide.

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.

None yet

5 participants