TypeScript Support
Feature Request
Introducing typescript support for the repo.
Why it is needed
With the increasing popularity in typescript, it would be nice to have typescript support or at least a type declaration for the repo.
Currently, this repo does not have a typescript definition in @types repo.
There are declaration files in @types/react-native that can be extracted to this repository.
Possible implementation
I believe there are two ways to approach this.
- create an
index.d.tsfile, extracted from@types/react-native - convert each js files into
.tsxand rewrite the modules in typescript
Any thoughts?
Code sample
Agree with that, and we should TypeScriptify the test files
https://github.com/react-native-community/react-native-checkbox/tree/typescript/main
↑ I made a new branch which name is typescript/main , let us work on it
Any progress so far?
Impossible to use this module on TS project, when this feature will be released?
0.4.0 was just released, it supports for TypeScript. please try it.
Hi @nicholaslee119
Looks like 0.4.1 doesn't work with TypeScript.
import CheckBox from '@react-native-community/checkbox';
Cannot find module '@react-native-community/checkbox' or its corresponding type declarations.
I think maybe this is a problem with
"types": "dist/CheckBox.d.ts" in package.json library because this file doesn't exists
@irekrog Thanks for your report, we would fix this bug as soon as possible
Hey @nicholaslee119 :) Any update on the fix release date ? :)
@irekrog I'm facing the same issue :(
Looks like 0.4.1 doesn't work with TypeScript.
import CheckBox from '@react-native-community/checkbox';
Cannot find module '@react-native-community/checkbox' or its corresponding type declarations.
6 months later ... No update!???
v0.4.2 was released, Typescript support is fixed. Thank you for your patience, Try it if there is any problem let us known, please
Just installed v0.4.2 but getting the error Unable to resolve path to module '@react-native-community/checkbox'
Import works fine, but I cannot get autocompletion for this components' props.
Just installed v0.4.2 but getting the error
Unable to resolve path to module '@react-native-community/checkbox'Import works fine, but I cannot get autocompletion for this components' props.
Have you ever tried to restart your IDE?
Just installed v0.4.2 but getting the error
Unable to resolve path to module '@react-native-community/checkbox'Import works fine, but I cannot get autocompletion for this components' props.Have you ever tried to restart your IDE?
I also have this "Unable to resolve" error in VSCode, tried to restart IDE but error remains. Using 0.4.2
Sorry for the delay, 0.5.2 was just released to fix this bug
Just installed v0.5.3 Typings seems ok, but I still get the error "Unable to resolve path to module '@react-native-community/checkbox'" I tried to delete node_modules and clear intellij's cache/restart
Having the same problem. Everything installed but error Module not found: Can't resolve '@react-native-community/checkbox' still persists.
"@react-native-community/checkbox": "^0.5.6" And I'm getting the error with Typescript...
I'm also getting this error with Flow
"@react-native-community/checkbox": "^0.5.6"
in package.json: "main": "dist/CheckBox",
in dist dir:

obviously, eslint can't handle that situation