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

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

Merged
merged 3 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/olive-jeans-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix types not working properly when using `moduleResolution: 'node16'`
10 changes: 5 additions & 5 deletions packages/astro/astro-jsx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ declare namespace astroHTML.JSX {
children?: Children;
}

type AstroBuiltinProps = import('./dist/@types/astro').AstroBuiltinProps;
type AstroBuiltinAttributes = import('./dist/@types/astro').AstroBuiltinAttributes;
type AstroDefineVarsAttribute = import('./dist/@types/astro').AstroDefineVarsAttribute;
type AstroScriptAttributes = import('./dist/@types/astro').AstroScriptAttributes &
type AstroBuiltinProps = import('./dist/@types/astro.js').AstroBuiltinProps;
type AstroBuiltinAttributes = import('./dist/@types/astro.js').AstroBuiltinAttributes;
type AstroDefineVarsAttribute = import('./dist/@types/astro.js').AstroDefineVarsAttribute;
type AstroScriptAttributes = import('./dist/@types/astro.js').AstroScriptAttributes &
AstroDefineVarsAttribute;
type AstroStyleAttributes = import('./dist/@types/astro').AstroStyleAttributes &
type AstroStyleAttributes = import('./dist/@types/astro.js').AstroStyleAttributes &
AstroDefineVarsAttribute;

// This is an unfortunate use of `any`, but unfortunately we can't make a type that works for every framework
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/config.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// 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`

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
// However, they will for its properties, ex: Astro.request will show the AstroGlobal.request description
Expand Down
5 changes: 4 additions & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
"./tsconfigs/*": "./tsconfigs/*.json",
"./jsx/*": "./dist/jsx/*",
"./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/node": "./dist/core/app/node.js",
"./client/*": "./dist/runtime/client/*",
Expand Down