Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove error.code #250

Merged
merged 3 commits into from May 14, 2019
Merged

Remove error.code #250

merged 3 commits into from May 14, 2019

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented May 14, 2019

error.code is deprecated in favor of error.exitCode and error.exitCodeName. This PR removes it from the TypeScript definition.

I am not sure whether unknown properties are an issue with TypeScript. If they are, feel free to close this PR.

@sindresorhus
Copy link
Owner

Let's just remove it completely. You were right. It's confusing and weird to have it now that we have the other properties.

@ehmicky ehmicky force-pushed the feature/remove-code-in-typescript branch from b77e9ff to 1f427fd Compare May 14, 2019 17:00
@ehmicky ehmicky changed the title Remove error.code in TypeScript definitions Remove error.code May 14, 2019
@sindresorhus
Copy link
Owner

execa/index.js

Line 425 in 1f427fd

result.code = result.status;
?

@ehmicky
Copy link
Collaborator Author

ehmicky commented May 14, 2019

That's because for some reason spawnSync() returns the exit code with a signal property name, while spawn() use a code property name. We:

  • normalize both to result.code
  • use result.code to set result.exitCode and result.exitCodeName
  • delete result.code

I agree it looks bad though, I refactored it.

@sindresorhus sindresorhus merged commit bc0984e into master May 14, 2019
@sindresorhus sindresorhus deleted the feature/remove-code-in-typescript branch May 14, 2019 17:40
This was referenced May 15, 2019
stianjensen added a commit to stianjensen/react-native-community-cli that referenced this pull request Mar 27, 2023
https://github.com/sindresorhus/execa/releases

5.x is the last version before the package is being rewritten to ESM.

execa now ships with typescript types embedded.

I see a previous attempt here was aborted:
react-native-community#1514

Relevant breaking changes:
error.code is deprecated in favor of error.exitCode
sindresorhus/execa#250
Some changes to stripping the final newline:
sindresorhus/execa@f8397ba
adamTrz pushed a commit to react-native-community/cli that referenced this pull request Mar 28, 2023
https://github.com/sindresorhus/execa/releases

5.x is the last version before the package is being rewritten to ESM.

execa now ships with typescript types embedded.

I see a previous attempt here was aborted:
#1514

Relevant breaking changes:
error.code is deprecated in favor of error.exitCode
sindresorhus/execa#250
Some changes to stripping the final newline:
sindresorhus/execa@f8397ba
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.

None yet

2 participants