Support native import paths & signatures #283
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Since its initial release, Glint has required users to use customized reexported versions of items from the
@ember/component
,@glimmer/component
andember-modifier
packages in order for developers to be able to provide the granularity of type information needed to be able to typecheck those entities.Now that emberjs/rfcs#748 has been merged and implemented, we can instead augment those modules themselves, accounting for the signature structure that was ultimately agreed upon there.
This change allows users of
@glint/environment-ember-loose
to opt into native integration by importing@glint/environment-ember-loose/native-integration
somewhere in their ambient types.Change Details
Note for reviewers: this should be much more consumable commit-by-commit than looking at the total diff.
At a high level, this PR:
@types/ember__component
andember-modifier
to get their most recent type accommodations for Glintnative-integration
module with appropriate declarationsMigration
As users move from the
environment-ember-loose
reexports to the native import paths, they'll also need to update their signatures. Developers can make this migration incrementally or all at once, updating to our eventual 0.8 release that drops the reexports when they're done.For components, there are two key changes (see the relevant section in the RFC):
Yields
has becomeBlocks
. This key has a more complex notional desugaring, but the shorthand is compatible with howYields
worked before.Args
andPositionalArgs
have been merged intoArgs: { Named: ...; Positional: ... };
. If your component only has named args, you can skip the wrapping layer and continue to useArgs: MyNamedArgs
instead.For helpers and modifiers,
NamedArgs
andPositionalArgs
have been merged intoArgs: { Named: ...; Positional: ... }
similar to the change for components. However, since neither named nor positional args are more privileged in today's implementation of helpers and modifiers, there is no shorthand.Still To Come
This diff was large enough already that I felt it merited a PR, but additional work is still pending for this to be ready for consumption. In particular, we need:
environment-ember-loose
'sComponentLike
that accounts for the new signature structure (and doesn't require an import fromenvironment-ember-loose
)At some point we also need to update
@glint/environment-glimmerx
as well, but that depends on that set of packages updating their own dependencies on@glimmer/*
packages first.At some point after the above has been released, we'll cut Glint 0.8.0 which will:
native-integration
opt-in import and instead always provide the integration declarations when includedember-modifier
and@glimmer/component
at their minimum signature-compatible versions aspeerDependencies
to@glint/environment-ember-loose
.