Skip to content

Commit

Permalink
fix: type
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Aug 4, 2023
1 parent 9a9901b commit c39ff68
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"license": "MIT",
"name": "tw-react",
"version": "0.6.0",
"version": "0.6.1",
"url": "https://github.com/tiddly-gittly/tw-react",
"author": "Lin Onetwo",
"types": "dist/lib/index.d.ts",
Expand All @@ -25,7 +25,7 @@
"dev": "pnpm run make && pnpm run download-react && pnpm run run-action && zx ./scripts/mv-dev.mjs",
"clean": "rm -rf ./dist",
"build": "zx esbuild.config.mjs && zx scripts/after-build.mjs && zx esbuild.react_jsx-runtime.config.mjs",
"build:type": "tsc --emitDeclarationOnly && zx scripts/after-build-type.mjs",
"build:type": "tsc --emitDeclarationOnly --declaration && zx scripts/after-build-type.mjs",
"run-action": "zx scripts/run-action.mjs",
"prepublishOnly": "pnpm run make && pnpm run build:type",
"download-react": "zx scripts/download-react.mjs",
Expand Down
2 changes: 1 addition & 1 deletion scripts/after-build-type.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ await fs.copy(path.join(repoDir, 'src'), distLibDir, pluginCopyOptions);

// manually add this, otherwise it will be changed by tsc to `/// <reference types="src/type" />` which is totally wrong.
const distributionIndexFilePath = path.join(distLibDir, './index.d.ts');
const stringToPrepend = '/// <reference types="type.d.ts" />';
const stringToPrepend = '/// <reference types="./type.d.ts" />';
const data = await fs.readFile(distributionIndexFilePath, 'utf8');
const newData = `${stringToPrepend}\n${data}`;
await fs.writeFile(distributionIndexFilePath, newData);
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"extends": "@modern-js/tsconfig/base.json",
"compilerOptions": {
"declaration": true,
"declaration": false,
"baseUrl": "./",
"typeRoots" : ["node_modules/@types", "node_modules/tw5-typed", "./src/flow-chart/type.d.ts"],
"outDir": "dist/lib",
"typeRoots" : ["node_modules/@types", "node_modules/tw5-typed"],
"jsx": "react-jsx" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
"lib": ["DOM", "ESNext"]
},
Expand Down

0 comments on commit c39ff68

Please sign in to comment.