Skip to content

Commit

Permalink
feat: set up TypeScript declaration files generation
Browse files Browse the repository at this point in the history
This process was based on a TypeScript official guide: https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html.
  • Loading branch information
CharlesMangwa committed Apr 19, 2024
1 parent f2951de commit faad631
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 20 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ DerivedData

*.xcuserstate


*.hprof

# Android/IntelliJ
Expand All @@ -44,7 +43,6 @@ local.properties
npm-debug.log
yarn-error.log


# BUCK
buck-out/
\.buckd/
Expand All @@ -66,3 +64,4 @@ buck-out/
*.bundle
sample/ios/Podfile.lock
sample/android/app/google-services.json
typescript/*
41 changes: 23 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
{
"name": "react-native-emarsys-wrapper",
"version": "1.17.0",
"description": "React Native wrapper for Emarsys SDK",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"react-native",
"Emarsys"
],
"author": "emarsys",
"license": "MIT",
"peerDependencies": {
"react": ">=17.0.2",
"react-native": ">=0.67.3"
}
"name": "react-native-emarsys-wrapper",
"version": "1.17.0",
"description": "React Native wrapper for Emarsys SDK",
"main": "index.js",
"types": "typescript/index.d.ts",
"type": "module",
"scripts": {
"prepare": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"react-native",
"Emarsys"
],
"author": "emarsys",
"license": "MIT",
"devDependencies": {
"typescript": ">=3.7.2"
},
"peerDependencies": {
"react": ">=17.0.2",
"react-native": ">=0.67.3"
}
}
17 changes: 17 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Tells TypeScript where to look for files to work with.
"include": ["index.js", "src/**/*"],
"compilerOptions": {
// Tells TypeScript to read JS files, as normally they are ignored as source files.
"allowJs": true,
// Generate .d.ts files.
"declaration": true,
// This compiler run should only output .d.ts files.
"emitDeclarationOnly": true,
// Types should go into this directory.
// Removing this option will place the .d.ts files next to their .js source files.
"outDir": "typescript",
// Generate declaration files to go to js file when using IDE functions like "Go to Definition".
"declarationMap": true
}
}

0 comments on commit faad631

Please sign in to comment.