Skip to content

Fix for "Type 'Timeout' is not assignable to type 'number'" #272

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

Merged
merged 2 commits into from
Jun 21, 2022

Conversation

retyui
Copy link
Contributor

@retyui retyui commented Jun 20, 2022

Issue:

001

To reproduce:

npx react-native init MyApp --template react-native-template-typescript
cd MyApp

After fix

00022

@orta
Copy link
Member

orta commented Jun 20, 2022

Systematically, I think this is probably the right call for RN.

It disables the default of including all global types in a project (aka DOM, and anything which isn't RN/Jest) which makes it a bit of a breaking change, but I assume this is only used at the start of a project?

@radko93
Copy link
Collaborator

radko93 commented Jun 20, 2022

@orta thanks for your input. Yes, this only affects new projects. It might be a good change to cut out things not in scope.

Workaround: ReturnType<typeof setTimeout> but does not really resolve this issue.

@emin93
Copy link
Member

emin93 commented Jun 20, 2022

I agree with @radko93's approval.

Another workaround is to use window.setTimeout which I've been using until now. Good to see that there is a better alternative.

@radko93 radko93 merged commit efd4e07 into react-native-community:main Jun 21, 2022
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