Skip to content

Commit d6d34fb

Browse files
Merge branch 'canary' into fix/build-restart-log
2 parents 2c70efa + e75c366 commit d6d34fb

File tree

2 files changed

+60
-3
lines changed

2 files changed

+60
-3
lines changed

packages/next/src/lib/typescript/writeConfigurationDefaults.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type DesiredCompilerOptionsShape = {
2020

2121
function getDesiredCompilerOptions(
2222
ts: typeof import('typescript'),
23-
userTsConfig?: { compilerOptions?: CompilerOptions }
23+
tsOptions?: CompilerOptions
2424
): DesiredCompilerOptionsShape {
2525
const o: DesiredCompilerOptionsShape = {
2626
// These are suggested values and will be set when not present in the
@@ -80,7 +80,7 @@ function getDesiredCompilerOptions(
8080
reason: 'to match webpack resolution',
8181
},
8282
resolveJsonModule: { value: true, reason: 'to match webpack resolution' },
83-
...(userTsConfig?.compilerOptions?.verbatimModuleSyntax === true
83+
...(tsOptions?.verbatimModuleSyntax === true
8484
? undefined
8585
: {
8686
isolatedModules: {
@@ -139,7 +139,7 @@ export async function writeConfigurationDefaults(
139139
isFirstTimeSetup = true
140140
}
141141

142-
const desiredCompilerOptions = getDesiredCompilerOptions(ts, userTsConfig)
142+
const desiredCompilerOptions = getDesiredCompilerOptions(ts, tsOptions)
143143

144144
const suggestedActions: string[] = []
145145
const requiredActions: string[] = []

test/integration/tsconfig-verifier/test/index.test.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,63 @@ import path from 'path'
567567
`)
568568
})
569569

570+
it('allows you to set verbatimModuleSyntax true via extends without adding isolatedModules', async () => {
571+
expect(await exists(tsConfig)).toBe(false)
572+
expect(await exists(tsConfigBase)).toBe(false)
573+
574+
await writeFile(
575+
tsConfigBase,
576+
`{ "compilerOptions": { "verbatimModuleSyntax": true } }`
577+
)
578+
await writeFile(tsConfig, `{ "extends": "./tsconfig.base.json" }`)
579+
await new Promise((resolve) => setTimeout(resolve, 500))
580+
const { code, stderr, stdout } = await nextBuild(appDir, undefined, {
581+
stderr: true,
582+
stdout: true,
583+
})
584+
expect(stderr + stdout).not.toContain('isolatedModules')
585+
expect(code).toBe(0)
586+
587+
expect(await readFile(tsConfig, 'utf8')).toMatchInlineSnapshot(`
588+
"{
589+
\\"extends\\": \\"./tsconfig.base.json\\",
590+
\\"compilerOptions\\": {
591+
\\"lib\\": [
592+
\\"dom\\",
593+
\\"dom.iterable\\",
594+
\\"esnext\\"
595+
],
596+
\\"allowJs\\": true,
597+
\\"skipLibCheck\\": true,
598+
\\"strict\\": false,
599+
\\"noEmit\\": true,
600+
\\"incremental\\": true,
601+
\\"esModuleInterop\\": true,
602+
\\"module\\": \\"esnext\\",
603+
\\"moduleResolution\\": \\"node\\",
604+
\\"resolveJsonModule\\": true,
605+
\\"jsx\\": \\"preserve\\",
606+
\\"plugins\\": [
607+
{
608+
\\"name\\": \\"next\\"
609+
}
610+
],
611+
\\"strictNullChecks\\": true
612+
},
613+
\\"include\\": [
614+
\\"next-env.d.ts\\",
615+
\\".next/types/**/*.ts\\",
616+
\\"**/*.ts\\",
617+
\\"**/*.tsx\\"
618+
],
619+
\\"exclude\\": [
620+
\\"node_modules\\"
621+
]
622+
}
623+
"
624+
`)
625+
})
626+
570627
it('allows you to extend another configuration file', async () => {
571628
expect(await exists(tsConfig)).toBe(false)
572629
expect(await exists(tsConfigBase)).toBe(false)

0 commit comments

Comments
 (0)