This is a reduced repro for an intermittent tsgo --build type-check failure we started seeing after switching CI to the TS Go beta. Our full monorepo fails somewhere in the range of 1-5% of runs, but this repro fails around 30-50% of clean builds. tsc --build (TypeScript 6) passes consistently.
Setup:
tsconfig.pathsaliasesreactandreact-domtopreact/compat.react,react-dom, and@types/reactare also installed innode_modules.- The repro passes Preact-typed components into
@tiptap/reactAPIs. TipTap's.d.tsfiles importreact, which trace resolution shows resolving topreact/compat; failing runs still report assignability errors involving@types/reactdeclarations.
tsgo --build schema/tsconfig.json should match tsc --build schema/tsconfig.json.
Starting from a clean build state, tsgo --build schema/tsconfig.json reports TS2345 at the TipTap renderer call sites on roughly 40% of runs.
tsgo --build schema/tsconfig.json --singleThreaded passes 100/100.
A single invocation without first deleting .tsbuildinfo will not show the flake. repeat.sh runs --clean then --build each iteration.
npm ci
npm run tsgo:repeat # default tsgo (100 runs)
npm run tsgo:repeat:single # tsgo --singleThreaded (100 runs)
npm run tsc:repeat # tsc control (100 runs)All rows: 100 iterations of --clean then --build via repeat.sh. The tsgo range spans multiple runs.
| harness invocation | fails / 100 |
|---|---|
bash repeat.sh tsc |
0 |
bash repeat.sh tsgo |
30–50 |
bash repeat.sh tsgo --singleThreaded |
0 |
From evidence/sample-failure.txt:
schema/node-view.ts(5,32): error TS2345: Argument of type 'ComponentType<ReactNodeViewProps>' is not assignable to parameter of type 'ComponentType<ReactNodeViewProps<HTMLElement>>'.
Type 'ComponentClass<ReactNodeViewProps, {}>' is not assignable to type 'ComponentType<ReactNodeViewProps<HTMLElement>>'.
Type 'ComponentClass<ReactNodeViewProps, {}>' is not assignable to type 'ComponentClass<ReactNodeViewProps<HTMLElement>, any>'.
Types of property 'contextType' are incompatible.
Type 'preact.Context<any> | undefined' is not assignable to type 'React.Context<any> | undefined'.
Type 'preact.Context<any>' is not assignable to type 'React.Context<any>'.
Types of property 'Provider' are incompatible.
Type 'preact.Provider<any>' is not assignable to type 'React.Provider<any>'.
Property '$$typeof' is missing in type 'Provider<any>' but required in type 'ProviderExoticComponent<ProviderProps<any>>'.
schema/ref-view.ts(5,28): error TS2345: Argument of type 'ForwardRefExoticComponent<RefAttributes<RefViewHandle>>' is not assignable to parameter of type 'ComponentType<RefViewHandle, RefAttributes<RefViewHandle>>'.
Property '$$typeof' is missing in type 'ForwardRefExoticComponent<RefAttributes<RefViewHandle>>' but required in type 'ForwardRefExoticComponent<Omit<RefAttributes<RefViewHandle>, "ref"> & RefAttributes<RefViewHandle>>'.
node-view.tsexercisesReactNodeViewRenderer(ComponentType<ReactNodeViewProps>).ref-view.tsexercises the same identity split throughnew ReactRenderer(...)with aforwardRef-typed component.
Within a single failing run, one or both call sites may be flagged. The React.Context<any> reference above sometimes appears fully-qualified:
import("<repo>/node_modules/@types/react/index").Context<any>
Tried a few modifications to the setup, each over 30 iterations.
Fixes the failure (0 / 30):
- Remove
@types/reactfromnode_modules. - Collapse all source to a single tsconfig with no project references and no
--build.
Still flakes:
- Add
"types": []totsconfig-base.json: 15 failures / 30. - Reduce to one call site (delete
schema/ref-view.ts): 4 failures / 30, lower rate.
tsc --build schema/tsconfig.json passes under every condition above.
In the trace runs we collected, both tsc and tsgo resolve @tiptap/react's import 'react' to node_modules/preact/compat/src/index.d.ts. evidence/tsgo-react-resolution.log is from a --traceResolution invocation that exited non-zero with TS2345 errors. Full traces: npm run trace:tsc, npm run trace:tsgo.
OS: darwin arm64 (Darwin 25.4.0)
CPU cores: 14
node: v20.18.0
npm: 10.8.2
tsc: 6.0.3
tsgo: 7.0.0-dev.20260519.1 (@typescript/native-preview)
preact 10.29.1
react 18.3.1
@types/react 18.3.28
@tiptap/core 2.27.2
@tiptap/react 2.27.2
.
├── package.json
├── package-lock.json
├── tsconfig-base.json
├── lib/
│ ├── tsconfig.json
│ ├── components.tsx # NodeView (ComponentType<ReactNodeViewProps>) + RefView (forwardRef)
│ └── views.ts # `Views` view-contract type
├── schema/
│ ├── tsconfig.json # ← the failing build target
│ ├── node-view.ts # ReactNodeViewRenderer(views.NodeView)
│ └── ref-view.ts # new ReactRenderer(views.RefView, …)
├── repeat.sh # 100-iter harness; takes `tsgo` (default) or `tsc` and extra flags
└── evidence/
├── sample-failure.txt
├── tsc-react-resolution.log
└── tsgo-react-resolution.log
tsconfig-base.json:
Failure output: failures/ (gitignored), with the first failure copied to failures/FIRST_FAILURE.out.
{ "compilerOptions": { "target": "es2020", "module": "commonjs", "jsx": "react-jsx", "jsxImportSource": "preact", "strict": true, "skipLibCheck": true, "incremental": true, "paths": { "react": ["./node_modules/preact/compat/"], "react/jsx-runtime": ["./node_modules/preact/jsx-runtime"], "react-dom": ["./node_modules/preact/compat/"], "react-dom/*": ["./node_modules/preact/compat/*"] } } }