Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
Force fork-ts-checker to watch all TS files in the repo
Browse files Browse the repository at this point in the history
There is an issue with fork-ts-checker (or perhaps we are misusing it) such that it does not re-typecheck the correct files when a change is made in the app, most notably for files that only export types. (TypeStrong/fork-ts-checker-webpack-plugin#611)

This change forces it to look at these files in our package source directories rather than the symlinks in node_modules created by yarn workspaces. Now they are correctly watched and new type errors show up when a type-only file is edited.

fix build error

fix yarn.lock

Move base tsconfig changes to desktop tsconfigs
  • Loading branch information
jtbandes committed May 15, 2021
1 parent 1427f7a commit 3c442db
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 8 deletions.
21 changes: 19 additions & 2 deletions desktop/main/tsconfig.json
@@ -1,7 +1,24 @@
{
"extends": "@foxglove/tsconfig/tsconfig.base.json",
"include": ["./**/*"],
"include": [
"./**/*",
// These includes are added to ensure that fork-ts-checker correctly typechecks changed files:
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/611
"../../app/*.ts",
"../../package.json",
"../../packages/log/src/**/*"
],
"compilerOptions": {
"noEmit": true
"rootDir": "../..",
"noEmit": true,

// These paths are added to ensure that fork-ts-checker correctly typechecks changed files.
// Using these resolutions will force TS to give us an error if we forgot to add these files to
// one of our tsconfig "include"s.
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/611
"paths": {
"@foxglove-studio/app/*": ["../../app/*"],
"@foxglove/*": ["../../packages/*", "../../packages/foxglove/*"]
}
}
}
26 changes: 23 additions & 3 deletions desktop/preload/tsconfig.json
@@ -1,9 +1,29 @@
{
"extends": "@foxglove/tsconfig/tsconfig.base.json",
"include": ["./**/*", "../common/types.ts"],
"include": [
"./**/*",
"../common/types.ts",

// These includes are added to ensure that fork-ts-checker correctly typechecks changed files:
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/611
"../../app/*.ts",
"../../package.json",
"../../packages/electron-socket/*",
"../../packages/electron-socket/src/**/*",
"../../packages/log/src/**/*"
],
"compilerOptions": {
"rootDir": "../",
"rootDir": "../..",
"noEmit": true,
"lib": ["dom", "es2020"]
"lib": ["dom", "es2020"],

// These paths are added to ensure that fork-ts-checker correctly typechecks changed files.
// Using these resolutions will force TS to give us an error if we forgot to add these files to
// one of our tsconfig "include"s.
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/611
"paths": {
"@foxglove-studio/app/*": ["../../app/*"],
"@foxglove/*": ["../../packages/*", "../../packages/foxglove/*"]
}
}
}
29 changes: 26 additions & 3 deletions desktop/renderer/tsconfig.json
@@ -1,10 +1,33 @@
{
"extends": "@foxglove/tsconfig/tsconfig.base.json",
"include": ["./**/*", "../common/**/*"],
"include": [
"./**/*",
"../common/**/*",

// These includes are added to ensure that fork-ts-checker correctly typechecks changed files:
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/611
"../../app/**/*",
"../../app/**/*.json",
"../../app/.storybook/**/*",
"../../package.json",
"../../packages/@foxglove/*/src/**/*",
"../../packages/*/src/**/*",
"../../packages/electron-socket/*",
"../../packages/velodyne-cloud/src/**/*.json"
],
"compilerOptions": {
"rootDir": "../",
"rootDir": "../..",
"noEmit": true,
"jsx": "react-jsx",
"lib": ["dom", "dom.iterable", "es2020"]
"lib": ["dom", "dom.iterable", "es2020"],

// These paths are added to ensure that fork-ts-checker correctly typechecks changed files.
// Using these resolutions will force TS to give us an error if we forgot to add these files to
// one of our tsconfig "include"s.
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/611
"paths": {
"@foxglove-studio/app/*": ["../../app/*"],
"@foxglove/*": ["../../packages/*", "../../packages/foxglove/*"]
}
}
}

0 comments on commit 3c442db

Please sign in to comment.