ts-strictify icon indicating copy to clipboard operation
ts-strictify copied to clipboard

feat: noUncheckedIndexedAccess support

Open danilofuchs opened this issue 4 years ago • 6 comments

Adds support for noUncheckedIndexedAccess flag, an even stricter flag.

https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/#no-unchecked-indexed-access

Update: On issue https://github.com/microsoft/TypeScript/issues/42659 the TS team instructed me to use tsc --help --all flag, which solved the issue.


Old comment, preserved for posterity

This change does not actually work, as this flag appears to not work when running tsc, only with inside tsconfig.json.

I created an issue on Typescript: https://github.com/microsoft/TypeScript/issues/42659

danilofuchs avatar Feb 05 '21 03:02 danilofuchs

Thanks to --all flag added, this also fixes the issue with typescript 4.4+ where they hide many options from --help and ts-strictify ends up calling tsc with only --noEmit flag and then incorrectly reports all files green.

Ref:

  • https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-4.html#tsc---help-updates-and-improvements
  • https://github.com/microsoft/TypeScript/pull/44157

falkenhawk avatar Oct 26 '21 15:10 falkenhawk

It looks like this repo is not maintained anymore, sadly. @danilofuchs have you perhaps built and published a version of your fork?

falkenhawk avatar Oct 26 '21 15:10 falkenhawk

It looks like this repo is not maintained anymore, sadly. @danilofuchs have you perhaps built and published a version of your fork?

Yes, I assume the repo owner migrated his project and stopped maintaining the tool.

I believe you can install using my fork ref directly, but I haven't tried it myself.

danilofuchs avatar Oct 26 '21 15:10 danilofuchs

Thanks to --all flag added, this also fixes the issue with typescript 4.4+

oh, actually ef702f3 is unfinished, --all should be still added at https://github.com/cschroeter/ts-strictify/blob/0a8c761155af36947e6f22d2db2de13229179328/src/lib/typescript.ts#L23

['--help', '--all']

falkenhawk avatar Oct 26 '21 15:10 falkenhawk

Thanks for quick answer @danilofuchs !

I believe you can install using my fork ref directly, but I haven't tried it myself.

I tried, using "ts-strictify": "danilofuchs/ts-strictify#ef702f35", in package.json, but that does not include dist folder so cli script defined in "bin": "./dist/cli.js", is not available compiled. Yeah I can try calling the original with ts-node ./node_modules/ts-strictify/src/cli.ts but that's a bit backbreaking 😅

falkenhawk avatar Oct 26 '21 16:10 falkenhawk

@falkenhawk I didn't even remember this, but I pushed a with-builds branch when testing this. Check if you can use it

danilofuchs avatar Oct 27 '21 17:10 danilofuchs