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

Fix compilation error with typescript 5 #230

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

darthmaim
Copy link
Contributor

When using typescript 5 in a project using superjson the build fails with the following error:

./node_modules/superjson/src/accessDeep.ts:102:5
Type error: Element implicitly has an 'any' type because expression of type 'string | number' can't be used to index type 'any[] | { [key: string]: any; }'.
  No index signature with a parameter of type 'string' was found on type 'any[] | { [key: string]: any; }'.

  100 | 
  101 |   if (isArray(parent) || isPlainObject(parent)) {
> 102 |     parent[lastKey] = mapper(parent[lastKey]);
      |     ^
  103 |   }
  104 | 
  105 |   if (isSet(parent)) {

This change fixes this error.

@darthmaim darthmaim requested a review from Skn0tt as a code owner April 18, 2023 13:11
@Skn0tt
Copy link
Collaborator

Skn0tt commented Apr 20, 2023

Nice, thank you!

@Skn0tt
Copy link
Collaborator

Skn0tt commented Apr 20, 2023

What's interesting to me is that your project seems to be importing the .ts files - that's surprising me, I'd have expected all projects to be using the dist/index.js file. Is that a special config option you did?

@Skn0tt Skn0tt merged commit bfaa86c into flightcontrolhq:main Apr 20, 2023
@Skn0tt
Copy link
Collaborator

Skn0tt commented Apr 20, 2023

@all-contributors please add @darthmaim for code

@allcontributors
Copy link
Contributor

@Skn0tt

I've put up a pull request to add @darthmaim! 🎉

@Skn0tt
Copy link
Collaborator

Skn0tt commented Apr 20, 2023

@darthmaim
Copy link
Contributor Author

What's interesting to me is that your project seems to be importing the .ts files - that's surprising me, I'd have expected all projects to be using the dist/index.js file. Is that a special config option you did?

No, I would also have expected this, but its just a default next.js project with next-superjson-plugin, I am not even using superjson directly

Here is the tsconfig if you are interested: https://github.com/GW2Treasures/gw2treasures.com/blob/main/apps/web/tsconfig.json
And here the PR to update to TS5 which currently fails: GW2Treasures/gw2treasures.com#122

Thanks for merging this PR ❤️

kodiakhq bot referenced this pull request in weareinreach/InReach Apr 20, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@aws-sdk/client-s3](https://togithub.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3) ([source](https://togithub.com/aws/aws-sdk-js-v3)) | [`3.316.0` -> `3.317.0`](https://renovatebot.com/diffs/npm/@aws-sdk%2fclient-s3/3.316.0/3.317.0) | [![age](https://badges.renovateapi.com/packages/npm/@aws-sdk%2fclient-s3/3.317.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@aws-sdk%2fclient-s3/3.317.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@aws-sdk%2fclient-s3/3.317.0/compatibility-slim/3.316.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@aws-sdk%2fclient-s3/3.317.0/confidence-slim/3.316.0)](https://docs.renovatebot.com/merge-confidence/) |
| [superjson](https://togithub.com/blitz-js/superjson) | [`1.12.2` -> `1.12.3`](https://renovatebot.com/diffs/npm/superjson/1.12.2/1.12.3) | [![age](https://badges.renovateapi.com/packages/npm/superjson/1.12.3/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/superjson/1.12.3/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/superjson/1.12.3/compatibility-slim/1.12.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/superjson/1.12.3/confidence-slim/1.12.2)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>aws/aws-sdk-js-v3</summary>

### [`v3.317.0`](https://togithub.com/aws/aws-sdk-js-v3/blob/HEAD/clients/client-s3/CHANGELOG.md#&#8203;33170-httpsgithubcomawsaws-sdk-js-v3comparev33160v33170-2023-04-20)

[Compare Source](https://togithub.com/aws/aws-sdk-js-v3/compare/v3.316.0...v3.317.0)

**Note:** Version bump only for package [@&#8203;aws-sdk/client-s3](https://togithub.com/aws-sdk/client-s3)

</details>

<details>
<summary>blitz-js/superjson</summary>

### [`v1.12.3`](https://togithub.com/blitz-js/superjson/releases/tag/v1.12.3)

[Compare Source](https://togithub.com/blitz-js/superjson/compare/v1.12.2...v1.12.3)

#### What's Changed

-   Fix compilation error with typescript 5 by [@&#8203;darthmaim](https://togithub.com/darthmaim) in [https://github.com/blitz-js/superjson/pull/230](https://togithub.com/blitz-js/superjson/pull/230)
-   docs: add darthmaim as a contributor for code by [@&#8203;allcontributors](https://togithub.com/allcontributors) in [https://github.com/blitz-js/superjson/pull/231](https://togithub.com/blitz-js/superjson/pull/231)

#### New Contributors

-   [@&#8203;darthmaim](https://togithub.com/darthmaim) made their first contribution in [https://github.com/blitz-js/superjson/pull/230](https://togithub.com/blitz-js/superjson/pull/230)

**Full Changelog**: flightcontrolhq/superjson@v1.12.2...v1.12.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/weareinreach/InReach).



PR-URL: #423
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

2 participants