Skip to content

Conversation

brunocroh
Copy link
Member

@brunocroh brunocroh commented Aug 3, 2025

Closes #113

This PR depends on PR #151 being merged first.

Overview

This PR introduces a new TypeScript transformation that automatically migrates deprecated util.types.isNativeError usage to the modern Error.isError API.

Additional work

This implements one additional case for utils/src/ast-grep/remove-binding.ts. Previously, it failed to remove deep named imports, so I fixed this behaviour and added a new test to prevent regression

Previous behaviour:

input

const { types: { isNativeError, isMap } } = require("util");

result

const { isMap } = require("util");

New behaviour:

input

const { types: { isNativeError, isMap } } = require("util");

result

const { types: { isMap } } = require("util");

@brunocroh brunocroh changed the title Feat/types is native error feat(types-is-native-error): introduce Aug 3, 2025
@brunocroh brunocroh marked this pull request as draft August 3, 2025 18:01
@brunocroh brunocroh force-pushed the feat/types-is-native-error branch from c288f36 to ddce49b Compare August 4, 2025 19:01
Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

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

LGMT with rebase

@brunocroh brunocroh force-pushed the feat/types-is-native-error branch from ddce49b to d519ac2 Compare August 6, 2025 21:14
@brunocroh brunocroh marked this pull request as ready for review August 6, 2025 21:15
Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

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

CI is green.

@AugustinMauroy AugustinMauroy requested a review from a team August 6, 2025 22:25
@brunocroh brunocroh requested a review from avivkeller August 13, 2025 07:34
@AugustinMauroy AugustinMauroy requested a review from a team August 13, 2025 09:08
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.

feat: handle util.types.isNativeError() depreciation
3 participants