Skip to content

setup(typescript): update - #146

Merged
AugustinMauroy merged 10 commits into
mainfrom
fix-tsconfig
Sep 17, 2025
Merged

AugustinMauroy merged 10 commits into
mainfrom
fix-tsconfig

Conversation

@AugustinMauroy

@AugustinMauroy AugustinMauroy commented Jul 29, 2025 •

Copy link
Copy Markdown
Member
  • update ts-config to only use root
  • use tsgo
  • Only use JS language

@JakobJingleheimer

Copy link
Copy Markdown
Member

Should we have 1 tsconfig at the root? 🤔

@AugustinMauroy

Copy link
Copy Markdown
Member Author

Should we have 1 tsconfig at the root? 🤔

That was the question with @brunocroh on discord.

@brunocroh

Copy link
Copy Markdown
Member

When we use npx codemod@init, it creates a tsconfig.json for each recipe.

From what I understand, each recipe needs to be independent. However, having duplicated TypeScript configs can be a pain when we need to update them.

What I'm thinking as a solution is to have a recipe-tsconfig.json at the root and copy it to each recipe folder during the publish process in CI.

@AugustinMauroy

AugustinMauroy commented Jul 29, 2025 •

Copy link
Copy Markdown
Member Author

do the codemod cli understand tsconfig.json if not just use at root for type checking ?
EDIT: check in .rs files the cli just understand paths something we won't use so maybe only have one at root.

@avivkeller

Copy link
Copy Markdown
Member

We can put a root tsconfig and add one to each directory extending the root one, if need be

@JakobJingleheimer

Copy link
Copy Markdown
Member

We can put a root tsconfig and add one to each directory extending the root one, if need be

That's what I was thinking

@AugustinMauroy AugustinMauroy changed the title fix: add missing tsconfig.json setup(tsconfig.json): use root and extend it Aug 3, 2025
@AugustinMauroy
AugustinMauroy requested a review from Copilot August 25, 2025 09:55
@AugustinMauroy AugustinMauroy changed the title setup(tsconfig.json): use root and extend it setup(typescript): update Aug 25, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates TypeScript configuration and type imports across the codebase to use more specific JavaScript AST types instead of generic TypesMap and Kinds types. It also introduces a new TypeScript compiler (tsgo) and updates the project dependencies.

  • Replaces generic TypesMap and Kinds<TypesMap> type parameters with specific JavaScript language types (Js)
  • Updates TypeScript tooling from standard TypeScript to @typescript/native-preview with tsgo compiler
  • Removes individual tsconfig.json files from recipe directories to use root configuration

Reviewed Changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
utils/src/ast-grep/*.ts Updated type parameters from generic TypesMap, Kinds<TypesMap> to specific Js type
recipes/*/src/workflow.ts Updated transform function signatures to use SgRoot<Js> instead of generic SgRoot
recipes/*/tsconfig.json Removed individual TypeScript configurations
package.json Updated TypeScript dependency and build script
.vscode/settings.json Enabled experimental tsgo support
Comments suppressed due to low confidence (2)

recipes/fs-access-mode-constants/src/workflow.ts:1

  • The @ts-expect-error comments are no longer needed since the type updates in this PR should have resolved the type compatibility issues between ast-grep and JSSG types.
import { getNodeRequireCalls } from "@nodejs/codemod-utils/ast-grep/require-call"

recipes/fs-access-mode-constants/src/workflow.ts:1

  • The @ts-expect-error comments are no longer needed since the type updates in this PR should have resolved the type compatibility issues between ast-grep and JSSG types.
import { getNodeRequireCalls } from "@nodejs/codemod-utils/ast-grep/require-call"

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@JakobJingleheimer JakobJingleheimer 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.

Should all of the tsconfigs (except the root one) be removed via this PR? (more were probably committed since you started this)

Aside from the committed test result mutation, looks fine to me. Only blocking to ensure that is not merged (which would cause the test to silently fail).

Comment thread recipes/correct-ts-specifiers/src/fixtures/e2e/test.ts
@AugustinMauroy

Copy link
Copy Markdown
Member Author

Should all of the tsconfigs (except the root one) be removed via this PR? (more were probably committed since you started this)

I had tried that but codemod cli wasn't happy. I am going to re try and maybe ask codemod team.

Aside from the committed test result mutation, looks fine to me. Only blocking to ensure that is not merged (which would cause the test to silently fail).

Good catch but strange

@JakobJingleheimer

Copy link
Copy Markdown
Member

I had tried that but codemod cli wasn't happy. I am going to re try and maybe ask codemod team.

just run:

git checkout main -- recipes/correct-ts-specifiers/src/fixtures/e2e/test.ts
git add recipes/correct-ts-specifiers/src/fixtures/e2e/test.ts
git commit -m 'fixup!: undo erroneous change to test file'

@AugustinMauroy

Copy link
Copy Markdown
Member Author

I had tried that but codemod cli wasn't happy. I am going to re try and maybe ask codemod team.

just run:

git checkout main -- recipes/correct-ts-specifiers/src/fixtures/e2e/test.ts

git add recipes/correct-ts-specifiers/src/fixtures/e2e/test.ts

git commit -m 'fixup!: undo erroneous change to test file'

I was talking about one root tsconfig file 😓

@JakobJingleheimer

Copy link
Copy Markdown
Member

@AugustinMauroy any luck from the codemod folks?

@JakobJingleheimer JakobJingleheimer added the blocked:upstream Depends on another PR or external change/fix label Sep 16, 2025
@AugustinMauroy AugustinMauroy removed the blocked:upstream Depends on another PR or external change/fix label Sep 17, 2025
@AugustinMauroy

Copy link
Copy Markdown
Member Author

Okay good now I didn't ask codemod team using lasted version it's work !

@JakobJingleheimer JakobJingleheimer 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.

Shall we switch to tsgo as part of this?

Comment thread recipes/fs-access-mode-constants/src/workflow.ts Outdated

@JakobJingleheimer JakobJingleheimer 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.

🙌

@AugustinMauroy
AugustinMauroy merged commit 0a41d52 into main Sep 17, 2025
30 checks passed
@JakobJingleheimer
JakobJingleheimer deleted the fix-tsconfig branch December 13, 2025 11:52
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.

5 participants