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

The type declaration of maria2/transport is missing #10

Closed
yjl9903 opened this issue Jul 12, 2023 · 13 comments
Closed

The type declaration of maria2/transport is missing #10

yjl9903 opened this issue Jul 12, 2023 · 13 comments

Comments

@yjl9903
Copy link
Contributor

yjl9903 commented Jul 12, 2023

VS Code can not properly find the type declaration of maria2/transport, with only exports fields in package.json.

In my previous experience, add the following typesVersions field may help.

https://github.com/antfu/unplugin-auto-import/blob/f70ea9bea38df4d1632bd466ddaee0b5274ef07a/package.json#L80-L87

@hydrati
Copy link
Owner

hydrati commented Jul 12, 2023

OK, I will try

@hydrati
Copy link
Owner

hydrati commented Jul 12, 2023

Maybe fixed in v0.3.0-beta.8. Have a try 😉 @yjl9903

@yjl9903
Copy link
Contributor Author

yjl9903 commented Jul 12, 2023

Maybe fixed in v0.3.0-beta.8. Have a try 😉 @yjl9903

maria2/transport works, but the type of maria2 breaks (

@yjl9903
Copy link
Contributor Author

yjl9903 commented Jul 12, 2023

image

Wish export the Socket related types in maria2/transport

@hydrati
Copy link
Owner

hydrati commented Jul 12, 2023

omg...

Reference in new issue

I tested on my VSC, there is no problem. @yjl9903

@yjl9903
Copy link
Contributor Author

yjl9903 commented Jul 12, 2023

image

I debug in the node_modules. It seems this will work.

@hydrati
Copy link
Owner

hydrati commented Jul 12, 2023

image

I debug in the node_modules. It seems this will work.

image

Update to v0.3.0-beta.9 and it may be fixed. 😥

@yjl9903
Copy link
Contributor Author

yjl9903 commented Jul 12, 2023

Still only maria2/transport works, but not maria2 😥

By the way, my environment:

  IDEs:
    VSCode: 1.80.0 - C:\Users\XLor\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
  npmPackages:
    @naria2/node: workspace:* => 0.0.5
    @types/node: ^18.16.19 => 18.16.19
    @types/ws: ^8.5.5 => 8.5.5
    bumpp: latest => 9.1.1
    naria2: workspace:* => 0.0.5
    turbo: ^1.10.7 => 1.10.7
    typescript: ^5.1.6 => 5.1.6
    unbuild: ^1.2.1 => 1.2.1
    vite: ^4.4.3 => 4.4.3
    vitest: ^0.33.0 => 0.33.0
    ws: ^8.13.0 => 8.13.0

@hydrati
Copy link
Owner

hydrati commented Jul 12, 2023

Emm...I can't find the reason...

image

image

@yjl9903
Copy link
Contributor Author

yjl9903 commented Jul 12, 2023

I don't know why mine does not work 😥

Consider this

  "typesVersions": {
    "*": {
      ".": [
        "./dist/index.d.ts"
      ],
      "transport": [
        "./dist/transport.d.ts"
      ]
    }
  },

or this to be more robust?🤣

  "typesVersions": {
    "*": {
      "*": [
        "./dist/*",
        "./*"
      ]
    }
  },

@so1ve
Copy link

so1ve commented Jul 12, 2023

"exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/index.js"
    }
  },
  "main": "dist/index.js",
  "module": "dist/index.js",
  "types": "dist/index.d.ts",
  "typesVersions": {
    "*": {
      "*": [
        "./dist/*",
        "./dist/index.d.ts"
      ]
    }
  },

@hydrati
Copy link
Owner

hydrati commented Jul 12, 2023

image

Now. @yjl9903

@yjl9903
Copy link
Contributor Author

yjl9903 commented Jul 12, 2023

Ok, it seems work

@yjl9903 yjl9903 closed this as completed Jul 12, 2023
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

No branches or pull requests

3 participants