Skip to content

feat: also generate a tsconfig.json when using TypeScript#176

Merged
dcrousso merged 1 commit into
microsoft:mainfrom
dcrousso:fix-41246
Jun 17, 2026
Merged

feat: also generate a tsconfig.json when using TypeScript#176
dcrousso merged 1 commit into
microsoft:mainfrom
dcrousso:fix-41246

Conversation

@dcrousso

Copy link
Copy Markdown
Contributor

@dcrousso
dcrousso requested review from Skn0tt, dgozman and yury-s June 16, 2026 21:53

@Skn0tt Skn0tt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the target/module/moduleResolution fields in the config? When I open it in VS Code, things work just fine without the fields, and only types added.

Comment thread assets/tsconfig.json
@@ -3,6 +3,9 @@
"allowSyntheticDefaultImports": true,
"noEmit": true,
"jsx": "react-jsx",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With TypeScript 6, the default for types changed: https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/#types-now-defaults-to-[]

This means we need to add "types": ["node"] here. It's weird that TypeScript docs on this aren't yet updated 🤔 microsoft/TypeScript#63392

Comment thread assets/tsconfig.json Outdated
"jsx": "react-jsx",
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get this compiler warning:

Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
  Visit https://aka.ms/ts6 for migration information.ts

Node is an alias to node10. I think we should go with bundler, since TypeScript doesn't do any compilation in our case and Playwright has it's own loader with lax semantics around module resolution:

Suggested change
"moduleResolution": "Node",
"moduleResolution": "bundler",

@dcrousso

Copy link
Copy Markdown
Contributor Author

Do we need the target/module/moduleResolution fields in the config? When I open it in VS Code, things work just fine without the fields, and only types added.

i was searching around trying to find a minimum viable tsconfig.json and those two fields were frequently listed (not to mention they're in our docs https://github.com/microsoft/playwright/blob/main/docs/src/test-typescript-js.md)

but if you dont think theyre necessary then i can remove :)

@Skn0tt Skn0tt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fields weren't necessary in my testing, and we haven't heard about it from Component Testing folks who already use this file. I'd ship without target, but leaving it up to you.

@dcrousso
dcrousso merged commit 380df0f into microsoft:main Jun 17, 2026
11 of 13 checks passed
@dcrousso
dcrousso deleted the fix-41246 branch June 17, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: create-playwright should emit a tsconfig.json for standard E2E TypeScript projects

2 participants