Skip to content

Commit 0d80b11

Browse files
ericmatthysijjk
andauthored
Warn when building a TS project with composite: true and fallback to incremental (#35270)
* Warn when building a TS project with composite: true and fallback to incremental * lint-fix Co-authored-by: JJ Kasper <[email protected]>
1 parent fb23f7b commit 0d80b11

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/next/lib/typescript/runTypeCheck.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { getTypeScriptConfiguration } from './getTypeScriptConfiguration'
77
import { getRequiredConfiguration } from './writeConfigurationDefaults'
88

99
import { CompileError } from '../compile-error'
10+
import { warn } from '../../build/output/log'
1011

1112
export interface TypeCheckResult {
1213
hasWarnings: boolean
@@ -40,19 +41,27 @@ export async function runTypeCheck(
4041
const options = {
4142
...effectiveConfiguration.options,
4243
...requiredConfig,
44+
declarationMap: false,
45+
emitDeclarationOnly: false,
4346
noEmit: true,
4447
}
4548

4649
let program:
4750
| import('typescript').Program
4851
| import('typescript').BuilderProgram
4952
let incremental = false
50-
if (options.incremental && cacheDir) {
53+
if ((options.incremental || options.composite) && cacheDir) {
54+
if (options.composite) {
55+
warn(
56+
'TypeScript project references are not fully supported. Attempting to build in incremental mode.'
57+
)
58+
}
5159
incremental = true
5260
program = ts.createIncrementalProgram({
5361
rootNames: effectiveConfiguration.fileNames,
5462
options: {
5563
...options,
64+
composite: false,
5665
incremental: true,
5766
tsBuildInfoFile: path.join(cacheDir, '.tsbuildinfo'),
5867
},

0 commit comments

Comments
 (0)