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(types): add loadAsync to Loader interface #2742

Merged
merged 1 commit into from
Feb 4, 2023

Conversation

Methuselah96
Copy link
Contributor

@Methuselah96 Methuselah96 commented Feb 1, 2023

When trying to use @types/three@0.149.0 with R3F, I get these type errors:


node_modules/@react-three/fiber/dist/declarations/src/core/hooks.d.ts:12:108 - error TS2344: Type 'InstanceType<L>["loadAsync"]' does not satisfy the constraint '(...args: any) => any'.

12 export declare type LoaderReturnType<T, L extends LoaderProto<T>> = T extends unknown ? Awaited<ReturnType<InstanceType<L>['loadAsync']>> : T;
                                                                                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@react-three/fiber/dist/declarations/src/core/hooks.d.ts:12:108 - error TS2536: Type '"loadAsync"' cannot be used to index type 'InstanceType<L>'.

12 export declare type LoaderReturnType<T, L extends LoaderProto<T>> = T extends unknown ? Awaited<ReturnType<InstanceType<L>['loadAsync']>> : T;
                                                                                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is caused by the loadAsync method being removed from THREE.Loader in three-types/three-ts-types#311, since there's not a good consistent type definition for it.

This fixes the situation by adding the loadAsync method here.

This change change should be backwards-compatible, I tested it with both @types/three@0.149.0 and @types/three@0.139.0.

The `loadAsync` method on `THREE.Loader` was removed in three-types/three-ts-types#311, since there's no consistent type definition for it.

This fixes the situation by adding the `loadAsync` method here.
@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 1, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 10c418b:

Sandbox Source
example Configuration

@Methuselah96 Methuselah96 changed the title Add loadAsync to Loader interface fix(types): add loadAsync to Loader interface Feb 1, 2023
@CodyJasonBennett CodyJasonBennett merged commit 633e8a4 into pmndrs:master Feb 4, 2023
@Methuselah96 Methuselah96 deleted the fix-loader-types branch February 4, 2023 14:01
renovate bot referenced this pull request in ziyadedher/ziyadedher Feb 5, 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 |
|---|---|---|---|---|---|
| [@react-three/fiber](https://togithub.com/pmndrs/react-three-fiber) |
[`8.10.1` ->
`8.10.4`](https://renovatebot.com/diffs/npm/@react-three%2ffiber/8.10.1/8.10.4)
|
[![age](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/compatibility-slim/8.10.1)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/confidence-slim/8.10.1)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>pmndrs/react-three-fiber</summary>

###
[`v8.10.4`](https://togithub.com/pmndrs/react-three-fiber/releases/tag/v8.10.4)

[Compare
Source](https://togithub.com/pmndrs/react-three-fiber/compare/v8.10.3...v8.10.4)

#### What's Changed

- fix: transpile class properties for wider browser support by
[@&#8203;belgattitude](https://togithub.com/belgattitude) in
[https://github.com/pmndrs/react-three-fiber/pull/2749](https://togithub.com/pmndrs/react-three-fiber/pull/2749)

**Full Changelog**:
pmndrs/react-three-fiber@v8.10.3...v8.10.4

###
[`v8.10.3`](https://togithub.com/pmndrs/react-three-fiber/releases/tag/v8.10.3)

[Compare
Source](https://togithub.com/pmndrs/react-three-fiber/compare/@react-three/fiber@8.10.2...v8.10.3)

##### What's Changed

- fix(types): add loadAsync to Loader interface by
[@&#8203;Methuselah96](https://togithub.com/Methuselah96) in
[https://github.com/pmndrs/react-three-fiber/pull/2742](https://togithub.com/pmndrs/react-three-fiber/pull/2742)
- fix: refactor ErrorBoundary to not use public class fields by
[@&#8203;belgattitude](https://togithub.com/belgattitude) in
[https://github.com/pmndrs/react-three-fiber/pull/2748](https://togithub.com/pmndrs/react-three-fiber/pull/2748)

##### New Contributors

- [@&#8203;belgattitude](https://togithub.com/belgattitude) made their
first contribution in
[https://github.com/pmndrs/react-three-fiber/pull/2748](https://togithub.com/pmndrs/react-three-fiber/pull/2748)

**Full Changelog**:
pmndrs/react-three-fiber@v8.10.1...v8.10.3

###
[`v8.10.2`](https://togithub.com/pmndrs/react-three-fiber/releases/tag/v8.10.2)

[Compare
Source](https://togithub.com/pmndrs/react-three-fiber/compare/@react-three/fiber@8.10.1...@react-three/fiber@8.10.2)

#### What's Changed

- fix: portal injects by [@&#8203;drcmda](https://togithub.com/drcmda)
in
pmndrs/react-three-fiber@0c288ba
- fix(RTTR): backport traverse, update fixes by
[@&#8203;CodyJasonBennett](https://togithub.com/CodyJasonBennett) in
[#&#8203;2736](https://togithub.com/pmndrs/react-three-fiber/issues/2736)

**Full Changelog**:
pmndrs/react-three-fiber@v8.10.1...v8.10.2

</details>

---

### Configuration

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

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->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/ziyadedher/ziyadedher).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMTkuNSIsInVwZGF0ZWRJblZlciI6IjM0LjEyMi4xIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
CodyJasonBennett added a commit that referenced this pull request Feb 27, 2023
ziyadedher referenced this pull request in ziyadedher/ziyadedher Dec 16, 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 |
|---|---|---|---|---|---|
| [@react-three/fiber](https://togithub.com/pmndrs/react-three-fiber) |
[`8.10.1` ->
`8.10.4`](https://renovatebot.com/diffs/npm/@react-three%2ffiber/8.10.1/8.10.4)
|
[![age](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/compatibility-slim/8.10.1)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/confidence-slim/8.10.1)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>pmndrs/react-three-fiber</summary>

###
[`v8.10.4`](https://togithub.com/pmndrs/react-three-fiber/releases/tag/v8.10.4)

[Compare
Source](https://togithub.com/pmndrs/react-three-fiber/compare/v8.10.3...v8.10.4)

#### What's Changed

- fix: transpile class properties for wider browser support by
[@&#8203;belgattitude](https://togithub.com/belgattitude) in
[https://github.com/pmndrs/react-three-fiber/pull/2749](https://togithub.com/pmndrs/react-three-fiber/pull/2749)

**Full Changelog**:
pmndrs/react-three-fiber@v8.10.3...v8.10.4

###
[`v8.10.3`](https://togithub.com/pmndrs/react-three-fiber/releases/tag/v8.10.3)

[Compare
Source](https://togithub.com/pmndrs/react-three-fiber/compare/@react-three/fiber@8.10.2...v8.10.3)

##### What's Changed

- fix(types): add loadAsync to Loader interface by
[@&#8203;Methuselah96](https://togithub.com/Methuselah96) in
[https://github.com/pmndrs/react-three-fiber/pull/2742](https://togithub.com/pmndrs/react-three-fiber/pull/2742)
- fix: refactor ErrorBoundary to not use public class fields by
[@&#8203;belgattitude](https://togithub.com/belgattitude) in
[https://github.com/pmndrs/react-three-fiber/pull/2748](https://togithub.com/pmndrs/react-three-fiber/pull/2748)

##### New Contributors

- [@&#8203;belgattitude](https://togithub.com/belgattitude) made their
first contribution in
[https://github.com/pmndrs/react-three-fiber/pull/2748](https://togithub.com/pmndrs/react-three-fiber/pull/2748)

**Full Changelog**:
pmndrs/react-three-fiber@v8.10.1...v8.10.3

###
[`v8.10.2`](https://togithub.com/pmndrs/react-three-fiber/releases/tag/v8.10.2)

[Compare
Source](https://togithub.com/pmndrs/react-three-fiber/compare/@react-three/fiber@8.10.1...@react-three/fiber@8.10.2)

#### What's Changed

- fix: portal injects by [@&#8203;drcmda](https://togithub.com/drcmda)
in
pmndrs/react-three-fiber@0c288ba
- fix(RTTR): backport traverse, update fixes by
[@&#8203;CodyJasonBennett](https://togithub.com/CodyJasonBennett) in
[#&#8203;2736](https://togithub.com/pmndrs/react-three-fiber/issues/2736)

**Full Changelog**:
pmndrs/react-three-fiber@v8.10.1...v8.10.2

</details>

---

### Configuration

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

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->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/ziyadedher/ziyadedher).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMTkuNSIsInVwZGF0ZWRJblZlciI6IjM0LjEyMi4xIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
itsdouges pushed a commit to itsdouges/react-three-fiber that referenced this pull request Jan 2, 2024
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