0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00

Fix types not working properly when using moduleResolution: 'node16' (#5108)

* Fix imports failling under `moduleResolution: node16`

* Add changeset

* Revert comment about Vite 4
This commit is contained in:
Erika 2022-10-17 11:29:39 -03:00 committed by GitHub
parent dd354f83e8
commit ce01225a70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 8 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix types not working properly when using `moduleResolution: 'node16'`

View file

@ -23,12 +23,12 @@ declare namespace astroHTML.JSX {
children?: Children; children?: Children;
} }
type AstroBuiltinProps = import('./dist/@types/astro').AstroBuiltinProps; type AstroBuiltinProps = import('./dist/@types/astro.js').AstroBuiltinProps;
type AstroBuiltinAttributes = import('./dist/@types/astro').AstroBuiltinAttributes; type AstroBuiltinAttributes = import('./dist/@types/astro.js').AstroBuiltinAttributes;
type AstroDefineVarsAttribute = import('./dist/@types/astro').AstroDefineVarsAttribute; type AstroDefineVarsAttribute = import('./dist/@types/astro.js').AstroDefineVarsAttribute;
type AstroScriptAttributes = import('./dist/@types/astro').AstroScriptAttributes & type AstroScriptAttributes = import('./dist/@types/astro.js').AstroScriptAttributes &
AstroDefineVarsAttribute; AstroDefineVarsAttribute;
type AstroStyleAttributes = import('./dist/@types/astro').AstroStyleAttributes & type AstroStyleAttributes = import('./dist/@types/astro.js').AstroStyleAttributes &
AstroDefineVarsAttribute; AstroDefineVarsAttribute;
// This is an unfortunate use of `any`, but unfortunately we can't make a type that works for every framework // This is an unfortunate use of `any`, but unfortunately we can't make a type that works for every framework

View file

@ -1,5 +1,5 @@
type ViteUserConfig = import('vite').UserConfig; type ViteUserConfig = import('vite').UserConfig;
type AstroUserConfig = import('./dist/@types/astro').AstroUserConfig; type AstroUserConfig = import('./dist/@types/astro.js').AstroUserConfig;
/** /**
* See the full Astro Configuration API Documentation * See the full Astro Configuration API Documentation

View file

@ -4,7 +4,7 @@
// As such, if the typings you're trying to add should be available inside ex: React components, they should instead // As such, if the typings you're trying to add should be available inside ex: React components, they should instead
// be inside `client-base.d.ts` // be inside `client-base.d.ts`
type Astro = import('./dist/@types/astro').AstroGlobal; type Astro = import('./dist/@types/astro.js').AstroGlobal;
// We have to duplicate the description here because editors won't show the JSDoc comment from the imported type // We have to duplicate the description here because editors won't show the JSDoc comment from the imported type
// However, they will for its properties, ex: Astro.request will show the AstroGlobal.request description // However, they will for its properties, ex: Astro.request will show the AstroGlobal.request description

View file

@ -37,7 +37,10 @@
"./tsconfigs/*": "./tsconfigs/*.json", "./tsconfigs/*": "./tsconfigs/*.json",
"./jsx/*": "./dist/jsx/*", "./jsx/*": "./dist/jsx/*",
"./jsx-runtime": "./dist/jsx-runtime/index.js", "./jsx-runtime": "./dist/jsx-runtime/index.js",
"./config": "./config.mjs", "./config": {
"types": "./config.d.ts",
"default": "./config.mjs"
},
"./app": "./dist/core/app/index.js", "./app": "./dist/core/app/index.js",
"./app/node": "./dist/core/app/node.js", "./app/node": "./dist/core/app/node.js",
"./client/*": "./dist/runtime/client/*", "./client/*": "./dist/runtime/client/*",