Skip to content

Add TypeScript definition#6

Merged
sindresorhus merged 1 commit intosindresorhus:masterfrom
BendingBender:typescript-defs
Mar 18, 2019
Merged

Add TypeScript definition#6
sindresorhus merged 1 commit intosindresorhus:masterfrom
BendingBender:typescript-defs

Conversation

@BendingBender
Copy link
Contributor

No description provided.

@sindresorhus sindresorhus merged commit 8ee750b into sindresorhus:master Mar 18, 2019
Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms).

@param input - [Code point](https://en.wikipedia.org/wiki/Code_point) of a character.
*/
Copy link
Owner

@sindresorhus sindresorhus Mar 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include the example from the readme here when creating these definitions (with changed import statement of course)? Usually examples are the best documentation, and without, it's harder to use them.

import {expectType} from 'tsd-check';
import isFullwidthCodePoint from '.';

const codePoint = '谢'.codePointAt(0) as number;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer ! and find it more readable, as it makes it clear it's only about removing undefined instead of as which could change the type completely.

Suggested change
const codePoint = '谢'.codePointAt(0) as number;
const codePoint = '谢'.codePointAt(0)!;

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

2 participants