-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Allow exporting of types from module script #2555
Comments
This should still work. Make sure you are on the latest version of svelte-check and the Svelte extension of your IDE |
I am on the latest version of {
"name": "zod",
"version": "0.0.1",
"scripts": {
"dev": "vite dev",
"build": "vite build && npm run package",
"preview": "vite preview",
"package": "svelte-kit sync && svelte-package && publint",
"prepublishOnly": "npm run package",
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"svelte": "./dist/index.js"
}
},
"files": [
"dist",
"!dist/**/*.test.*",
"!dist/**/*.spec.*"
],
"peerDependencies": {
"svelte": "^5.0.0-next.1"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/package": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"publint": "^0.1.9",
"svelte": "^5.0.0-next.1",
"svelte-check": "^4.0.5",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^5.0.11"
},
"svelte": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"dependencies": {
"zod": "^3.23.8"
}
} Unfortunately, it still doesn't work. It works just fine with regular exports. Here's my module script: <script module>
/**
* @typedef {"test"} TestType
*/
export const types = {};
</script> Here's my JS file: //@ts-check
/** @import { ZodIssue } from "zod" */
/** @import { TestType, types } from "$lib/components/ZodInput.svelte" */
/** @type {TestType} */
const x = ""; Unfortunately, Intellisense is not picking up TestType. Here's a screenshot of VSCode's intellisense yelling at me: |
Which version of the Svelte vs code extension do have installed? |
I'm seeing the same issue in latest Zed Preview. |
Describe the problem
In Svelte <=4, it was possible to export JSDOC custom types through the
context="module"
<script>
tag by simply declaring the type.In Svelte 5, it seems that types defined in the
module
script are not exported. At least, there's no clear way of doing it or no documentation on it.Describe the proposed solution
Allow users to export types from the module script, to be imported from anywhere in the project.
$lib/components/MyComponent.svelte
:$lib/util/misc.js
:Importance
would make my life easier
The text was updated successfully, but these errors were encountered: