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

[BUGFIX stable] Fix types for Resolver contract #20489

Merged
merged 1 commit into from
Jun 29, 2023
Merged

Commits on Jun 29, 2023

  1. [BUGFIX stable] Fix types for Resolver contract

    We need `Resolver` implementors (e.g. `ember-resolver`) to be able to
    provide a class which can satisfy this contract, which means we need to
    support either a static `.create()` method or a constructor (with a
    strong preference for the constructor). This is likely to be a common
    issue with this kind of assignability of classic classes, because it
    ultimately comes down to the definition of `Factory` and `CoreObject`.
    
    To resolve this, add two overloads for `CoreObject.prototype.create`:
    
    - One which just produces an instance type with no args at all.
    - One which produces an instance type by merging with passed-in args.
    
    These two overloads also improve the type safety of `.create()` more
    generally, allowing us to handle a couple cases which the types did not
    previously account for (and indeed had given up handling).
    
    This also adds a smoke test for something shaped like the `app.ts` file
    generated for every Ember app, so that we can be sure that the code we
    emit when generating an app actually works. For now, this simply copies
    over the types from `ember-resolver`, `ember-load-initializers`, and a
    basic `environment`.
    chriskrycho committed Jun 29, 2023
    Configuration menu
    Copy the full SHA
    4c99fa1 View commit details
    Browse the repository at this point in the history