Skip to content

typesctip 6 and package.json exports definitionsΒ #63318

@darkship

Description

@darkship

πŸ”Ž Search Terms

typescript 6, package.json exports

πŸ•— Version & Regression Information

  • This changed between versions 5.9.3 and 6.0.2

⏯ Playground Link

https://github.com/darkship/ts6-bug

πŸ’» Code

import type { GLTF } from "three/examples/jsm/loaders/GLTFLoader"

πŸ™ Actual behavior

$ tsc --noEmit
src/index.ts:1:28 - error TS2307: Cannot find module 'three/examples/jsm/loaders/GLTFLoader' or its corresponding type declarations.

1 import type {  GLTF } from "three/addons/loaders/GLTFLoader"
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/index.ts:3:40 - error TS7006: Parameter 'c' implicitly has an 'any' type.

3 const a = (b: GLTF)=> b.scene.traverse(c=>{
                                         ~


Found 2 errors in the same file, starting at: src/index.ts:1

πŸ™‚ Expected behavior

no error

Additional information about the issue

Export in three:0.153.0 and in @types/three:0.153.0 are defined as

    "exports": {
        //...
        "./addons/*": "./examples/jsm/*",
        //...
    }

which should allow to import anything from ./examples/jsm/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions