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

Reexport glint-compatible versions of upstream values #58

Merged
merged 10 commits into from
Mar 11, 2021
Merged

Conversation

dfreeman
Copy link
Member

Up to this point, we've managed to get by with declaration merging into upstream packages (@glimmerx/component, ember-modifier, etc) to make the types exported there compatible with glint's system for template typing. This was already somewhat perilous in that it required us to tack on additional type parameters to certain classes, assume TS would resolve our overload of a particular function rather than the more general upstream one, and so on.

With the changes in #54, we were no longer able to continue kicking that can down the road, and had to temporarily break fn and on from GlimmerX. Between this and the inconsistency between the Component<Args, Yields, ...> form factor we were forced into compared to the Component<{ Args, Yields, ... }> one we wanted, it's become clear that for the time being we can't continue to just augment existing types.

This PR updates the @glint/environment-* packages to re-export the necessary upstream values with types that are glint-compatible.

import Component from '@glimmerx/component';
import { helper, fn } from '@glimmerx/helper';
import { on } from '@glimmerx/modifier';
// =>
import { Component, helper, on, fn } from '@glint/environment-glimmerx'`
import EmberComponent from '@ember/component';
import Helper, { helper } from '@ember/component/helper';
import GlimmerComponent from '@glimmer/component';
import Modifier, { modifier } from 'ember-modifier';
// =>
import {
  EmberComponent, Helper, helper, GlimmerComponent, Modifier, modifier
} from '@glint/environment-ember-loose';

Hopefully this isn't a long-term solution and we'll be able to eventually land changes to the upstream types that make them, if not glint-aware, at least glint compatible.

Closes #25

@dfreeman dfreeman added the breaking A breaking change label Mar 10, 2021
@dfreeman dfreeman force-pushed the env-reexports branch 2 times, most recently from a6041c0 to 98ec1ed Compare March 10, 2021 21:47
@dfreeman dfreeman merged commit ed20090 into master Mar 11, 2021
@dfreeman dfreeman deleted the env-reexports branch March 11, 2021 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Figure out the shape of component type parameters
1 participant