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

TS1362 'GLTFLoader' cannot be used as a value because it was exported using 'export type'. #402

Closed
rosskevin opened this issue Jan 19, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@rosskevin
Copy link
Contributor

  • three-stdlib version: 2.35.11

Problem description:

Unable to instantiate in a module/moduleResolution nodenext due to changes in patch-ts

Relevant code:

import { GLTFLoader } from 'three-stdlib'

const gltfLoader = new GLTFLoader()

I'm looking at this @CodyJasonBennett - thank you for the effort so far. I'll experiment a bit on my side.

@rosskevin rosskevin added the bug Something isn't working label Jan 19, 2025
@rosskevin
Copy link
Contributor Author

rosskevin commented Jan 19, 2025

@CodyJasonBennett I'm not sure we need type added to everything, or if we want to blanket sed everything, we need to duplicate (the line with type * and *)

This works in index.d.ts

export * from './loaders/GLTFLoader.d.ts';

and this works as well

export type * from './loaders/GLTFLoader.d.ts';
export * from './loaders/GLTFLoader.d.ts';

export type as a blanket option helps with only type-based files, but we still need the * without type to export classes.

@CodyJasonBennett
Copy link
Member

Then let's remove it. I was under the impression it was needed when exporting from annotations.

@AbdBarho
Copy link

The following error I have now could be related to this issue:

Failed to compile.
./node_modules/three-stdlib/csm/CSMFrustum.d.ts:13:13
Type error: Identifier expected. 'default' is a reserved word that cannot be used here.
  11 | }
  12 |
> 13 | export type default class CSMFrustum {
     |             ^
  14 |   constructor(data?: CSMFrustumParameters)
  15 |   vertices: CSMFrustumVerticies
  16 |   setFromProjectionMatrix(projectionMatrix: Matrix4, maxFar: number): CSMFrustumVerticies

@CodyJasonBennett
Copy link
Member

I reverted the typescript changes which leaves us solely with #342 again. I think I need to express this issue upstream or extend the TypeScript compiler directly.

@CodyJasonBennett CodyJasonBennett closed this as not planned Won't fix, can't repro, duplicate, stale Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants