Skip to content

Add Typescript definitions - #225

Merged
Kureev merged 3 commits into
margelo:masterfrom
ahanriat:add-typescript-definition
Aug 7, 2017
Merged

Add Typescript definitions#225
Kureev merged 3 commits into
margelo:masterfrom
ahanriat:add-typescript-definition

Conversation

@ahanriat

@ahanriat ahanriat commented Aug 1, 2017

Copy link
Copy Markdown
Contributor

Hi Guys 👋

Just a quick PR to add Typescript definitions.
Hope you'll like it !

Cheers

@Kureev Kureev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

Comment thread index.d.ts
blurType: 'xlight' | 'light' | 'dark'
// tvOS only
| 'extraDark' | 'regular' | 'prominent';
blurAmount?: number; // 0 - 100

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we be more precise about the range?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @Kureev, the only possible way to do it currently would be to have a enum like:

blurAmount?: 0 | 1 | 2 | 3 | ... | 99 | 100;

This issue on Typescript is exactly what we are looking for, but it looks like there is currently no clean way to do it, appart using an enum microsoft/TypeScript#15480 👀

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah, got it! Thanks for the insight! Then I think it isn't a problem

@Kureev

Kureev commented Aug 2, 2017

Copy link
Copy Markdown
Collaborator

Hi @ahanriat!

Nice! Thank you for the PR! I have one question regarding the range of the number. We know in advance that the range is from 1 to 100, so maybe we can enforce it on the type level?

@Kureev
Kureev merged commit db215a9 into margelo:master Aug 7, 2017
@Kureev

Kureev commented Aug 7, 2017

Copy link
Copy Markdown
Collaborator

Thank you for this awesome contribution 🙌

Comment thread index.d.ts
blurType: 'xlight' | 'light' | 'dark'
// tvOS only
| 'extraDark' | 'regular' | 'prominent';
blurAmount?: number; // 0 - 100

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shouldn't viewRef be in there as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@arnibarnason doesn't the extends React.Component does this?

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.

4 participants