Tresjs / tres

Declarative ThreeJS using Vue Components
https://tresjs.org
MIT License
2.16k stars 102 forks source link

Type error #800

Closed mchao123 closed 4 weeks ago

mchao123 commented 1 month ago

Describe the bug

Bad types, unpredictable code, and false positives prevent me from using load-on-demand.Consider removing the global type declaration unless I actively add it?

'TresPrimitive' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.ts-plugin(1484)

(alias) type TresPrimitive = TresInstance & {
    object: TresInstance;
    isPrimitive: true;
}
import TresPrimitive

Reproduction

none

Steps to reproduce

No response

System Info

No response

Used Package Manager

npm

Code of Conduct

alvarosabu commented 4 weeks ago

Hi @mchao123, I think what the error is saying is that you have to import the type like this:

import type { TresPrimitive } from '@tresjs/core`

Instead of

import { TresPrimitive } from '@tresjs/core`

If you have the verbatimModuleSyntax enabled in your tsconfig. See https://stackoverflow.com/questions/76983697/why-does-my-vue-vite-typescript-application-require-me-to-separate-import-and

mchao123 commented 2 weeks ago

It's a misrepresentation on my part, it seems that there is no type declaration for "primitive" to be introduced on demand