react-native-checkbox icon indicating copy to clipboard operation
react-native-checkbox copied to clipboard

TypeScript Support

Open Naturalclar opened this issue 6 years ago • 26 comments

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.ts file, extracted from @types/react-native
  • convert each js files into .tsx and rewrite the modules in typescript

Any thoughts?

Code sample

Naturalclar avatar Dec 06 '19 21:12 Naturalclar

Agree with that, and we should TypeScriptify the test files

nicholaslee119 avatar Dec 14 '19 03:12 nicholaslee119

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

nicholaslee119 avatar Dec 14 '19 03:12 nicholaslee119

Any progress so far?

unnamed92 avatar Apr 15 '20 15:04 unnamed92

Impossible to use this module on TS project, when this feature will be released?

LanaIV avatar May 12 '20 16:05 LanaIV

0.4.0 was just released, it supports for TypeScript. please try it.

nicholaslee119 avatar May 13 '20 03:05 nicholaslee119

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 avatar May 13 '20 19:05 irekrog

@irekrog Thanks for your report, we would fix this bug as soon as possible

nicholaslee119 avatar May 14 '20 13:05 nicholaslee119

Hey @nicholaslee119 :) Any update on the fix release date ? :)

BenoitSerrano avatar May 20 '20 13:05 BenoitSerrano

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

flavio0567 avatar Jun 10 '20 20:06 flavio0567

6 months later ... No update!???

orihero avatar Jun 11 '20 18:06 orihero

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

nicholaslee119 avatar Jun 14 '20 09:06 nicholaslee119

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.

flo5324 avatar Jun 16 '20 10:06 flo5324

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?

nicholaslee119 avatar Jun 19 '20 01:06 nicholaslee119

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

tamirla avatar Jul 28 '20 12:07 tamirla

Sorry for the delay, 0.5.2 was just released to fix this bug

nicholaslee119 avatar Sep 08 '20 03:09 nicholaslee119

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

flo5324 avatar Sep 11 '20 10:09 flo5324

Having the same problem. Everything installed but error Module not found: Can't resolve '@react-native-community/checkbox' still persists.

studentenfutter1 avatar Dec 02 '20 23:12 studentenfutter1

"@react-native-community/checkbox": "^0.5.6" And I'm getting the error with Typescript...

mulssoni avatar Dec 04 '20 08:12 mulssoni

I'm also getting this error with Flow

"@react-native-community/checkbox": "^0.5.6"

JonasWho avatar Dec 08 '20 15:12 JonasWho

in package.json: "main": "dist/CheckBox",

in dist dir: Screenshot 2020-12-18 at 14 19 38

obviously, eslint can't handle that situation

maullerz avatar Dec 18 '20 11:12 maullerz