bitjson/typescript-starter

Strict config breaks yarn watch

Closed this issue · 1 comments

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    With a fresh clone, I run yarn watch and all is well.
    However, changing the config to use .strict instead of .flexible means that running yarn watch fails, evidently in part due to missing declaration files for hash.js which makes me wonder if it's related to the upgrade issue #36, as well as an import algorithm not being used.

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Error output (sorry for the weird symbols):

yarn watch v0.24.5
$ yarn build && yarn build:tests -- --no-browser && concurrently -r --kill-others 'npm run --silent build:main -- -w' 'npm run --silent build:tests -- -w --no-browser' 'sleepms 2000 && ava --watch' 
yarn build v0.24.5
$ trash build && yarn build:main && yarn build:module && yarn build:browser-deps && yarn build:browser && yarn build:browser-cjs && yarn build:resolve-sourcemaps 
yarn build:main v0.24.5
$ tsc -p tsconfig.json 

�[100;30m3�[0m import hash from 'hash.js'
�[100;30m �[0m �[91m                 ~~~~~~~~~�[0m

src/adapters/crypto.browser.ts(3,18): �[91merror�[0m TS7016: Could not find
a declaration file for module 'hash.js'.
 '/Users/heatherbooker/dev/garbage/typescript-starter/node_modules/hash.js/lib/hash.js'
 implicitly has an 'any' type.
  Try `npm install @types/hash.js` if it exists or add a new
declaration (.d.ts) file containing `declare module 'hash.js';`


�[100;30m10�[0m export function createHash (algorithm: 'sha256') {
�[100;30m  �[0m �[91m                            ~~~~~~~~~�[0m

src/adapters/crypto.browser.ts(10,29): �[91merror�[0m TS6133: 'algorithm'
is declared but never used.

@heatherbooker thanks for the report!

The latest version now includes a CLI (npx typescript-starter) which applies various configuration options. The repo also uses the strictest type-checking and linting settings to ensure we don't inadvertently break the strict configuration. 👍

For this particular issue, I also added an example file with lots more info: https://github.com/bitjson/typescript-starter/blob/master/src/types/example.d.ts

I'm going to close this issue for now, but please let me know if I should re-open.