react typescript types npm package code example
Example 1: npm typescript package
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"allowJs": true,
"strict": true,
"outDir": "./lib",
"esModuleInterop": true
},
"include": ["src"],
"exclude": ["node_modules"]
}
Example 2: npm typescript package
const demoMethod = () => {
return “I’m Duffer”;
}
module.exports = demoMethod;
Example 3: create react app with typescript declare types for libraries in npm
for create-react-app put your types in src/global.d.ts