Skip to content

Commit

Permalink
Update tsconfig.json to ref hoist-react as composite build
Browse files Browse the repository at this point in the history
+ Allow for distinct tsconfig options in HR vs. app-level. Relies on `composite: true` flag to be set in hoist-react tsconfig.json.
+ Re-order tsconfig options for clarity.
  • Loading branch information
amcclain committed Apr 10, 2024
1 parent 9f82b98 commit 3e0763e
Show file tree
Hide file tree
Showing 3 changed files with 207 additions and 195 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ bin/
out/
/client-app/build/
/client-app/node_modules/
/client-app/tsconfig.tsbuildinfo

# Logs #
########
Expand Down
24 changes: 12 additions & 12 deletions client-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"noEmit": true,

"target": "ES2022",
"module": "ES2022",
"lib": ["dom", "es2022"],

"jsx": "react",
"moduleResolution": "Node",
"skipLibCheck": true,

"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"noEmit": true,
"experimentalDecorators": true,
"noImplicitOverride": true,
"jsx": "react",
"resolveJsonModule": true,
"useDefineForClassFields": true,
"paths": {
"@xh/hoist/*": ["../../hoist-react/*"]

This comment has been minimized.

Copy link
@amcclain

amcclain Apr 10, 2024

Author Member

This was a bit of a weird setting for us to have in TB. As far as I can tell, it supports ctrl+clicking in IJ on a Hoist import to navigate to a locally checked-out copy, if you actually have such a copy at this path.

I don't think it's really appropriate to leave checked in here. Without it, ctrl+clicking still works, but takes you to the copy of hoist-react within node_modules.

This was not compatible as-is with the change we're making here.

},
"lib": [
"dom",
"es2022"
]
},
"references": [
{"path": "./node_modules/@xh/hoist"}
],

This comment has been minimized.

Copy link
@amcclain

amcclain Apr 10, 2024

Author Member

Works along with xh/hoist-react#3627

This is the key to having hoist-react's own tsconfig settings respected, were they to differ from those set here for toolbox.

Right now they do not differ across these two projects, but you can test this overall change by:

  • Editing this file to temporarily spec "noImplicitAny": true within compilerOptions - a stricter setting.
  • Run yarn tsc - note that many errors are thrown on TB files (because this app does not actually adhere to that strict standard itself), but none from HR.
  • Remove this references key from the TB tsconfig and re-run yarn tsc. Now HR will be compiled with the same settings as TB - note that now many more errors are thrown based on implicit any usages within the HR source. (This is the issue that the client hit that prompted the request to look at hoist-react)
"include": ["src"]
}
}
Loading

0 comments on commit 3e0763e

Please sign in to comment.