-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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(astro): strongly type Astro.self #7866
Conversation
🦋 Changeset detectedLatest commit: eb216b1 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
cc @Princesseuh |
So, in that type there's a bit of a confusion where sure, Ultimately, the type of astro/packages/astro/src/@types/astro.ts Line 141 in 682d02b
self . Then in the compiler, in the TSX we'll pass a typeof of the default function to the type param.
|
have updated this to take a the associated compiler change is here: withastro/compiler#843 |
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com> Co-authored-by: Princesseuh <princssdev@gmail.com>
Changes
Basically trying to strongly type
Astro.self
so we can get completions in the language tools.This is the safest non-breaking way I could think of doing it, since
AstroComponentFactory
should work as it did before if you don't specify any type parameters.I'm not entirely sure how
AstroComponentFactory
ends up working in TSX (in the type system) since it doesn't look like the shape of a JSX element. so this may also be the completely wrong solution. either way, if someone could explain that gap in my knowledge, that'd be super helpfulThis should fix withastro/language-tools#612
Testing
Couldn't find any existing tests for the types package. If there are some, i'm happy to add to them.
Docs
N/A since the behaviour should remain the same