1

Basically I am trying to customize a library file written in plain javascript and put it as a local file in a React-Native typescript project, the moment I try to convert the .js file to .ts/.tsx file, it throws a lots of linting issues, so fixing it is bit chaotic so I thought of keeping it as .js file only but I don't want to make any changes in the tsconfig file(i.e., adding jsallow = true), I know their is a way of adding some .d.ts file but not sure will it work or not and if it is, then what would be the syntax.

1 Answer 1

1

If this is a package named example, you can add types in example.d.ts using declare module "example" {}. There's more detailed information the Declaration Files Documentation.

Sign up to request clarification or add additional context in comments.

3 Comments

it would be good if you can hint me with the exact syntax as I am aware of this one but not sure how to import the file or point to that file within the application
I'd need more information about what you're importing and how, as TypeScript has different syntaxes for different types of modules that aren't compatible with each other.
I have customized the index.js(github.com/computerjazz/react-native-draggable-flatlist/…) and put it locally within the application source code folder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.