Skip to content

Commit

Permalink
get tsc working properly
Browse files Browse the repository at this point in the history
- `pnpm install` auto-updated the lockfile to 5.4 and added some things

- add `clean` and `tsc` commands to `package.json`

- change `tsconfig.json` settings
  - add `declaration: true` here instead of in `tsconfigOverride`
  - add `rootDir: './src'` so that types are output flatly into `dist`
    instead of in `dist/src`
  - add `skipLibCheck: true` as a recommended optimization from the TS team
    - it's quite a bit faster; I was wondering why `tsc` was a bit slow
      on such a tiny file, then saw `skipLibCheck` wasn't enabled
    - also because I was getting some type issues within `node_modules`,
      and this setting skips those as they're outside of our control

- after these changes, `pnpm run tsc` has correct output, while rpt2
  has incorrect output
  - the incorrect output is definitely because `check: false` is set and
    bc rpt2 is hitting a type-error when `check: true`
  - and the type-error is bc `pnpm`'s symlinks or something aren't
    being properly resolved
    - note that if you use regular NPM instead, rpt2 will have correct
      output: `rm -rf node_modules && npm install && npm run build`
  • Loading branch information
agilgur5 committed May 26, 2022
1 parent dd62c41 commit fba6ff3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
6 changes: 3 additions & 3 deletions dist/src/index.d.ts → dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export declare function useTmp(): {
bl: Ref<boolean>;
};
export declare function useTmp(): {
bl: Ref<boolean>;
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"description": "",
"main": "index.js",
"scripts": {
"clean": "rm -rf dist/",
"tsc": "tsc",
"build": "rollup -c",
"build:dts": "node ./scripts/dts"
},
Expand Down
26 changes: 23 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ export default {
tsconfigOverride: {
compilerOptions: {
declaration: true,
rootDir: path.resolve(__dirname),
},
},
}),
]
}
}
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"removeComments": false,
"jsx": "preserve",
"lib": ["esnext", "dom"],
"rootDir": "."
"rootDir": "./src",
"declaration": true,
"skipLibCheck": true
},
"include": [
"src"
Expand Down

0 comments on commit fba6ff3

Please sign in to comment.