-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[FEATURE] Publish stable types for Ember #20449
Commits on Apr 19, 2023
-
Publish types from source and remove preview types
Remove *all* preview types, update the publishing script to publish all packages from source, and update the publishing tsconfig to include all source packages. **This *does not work* yet.** However, it is a necessary first step in the process of switching to publishing stable types: the remaining types are too deeply entangled with each other to publish them in chunks as we have to date. (If there are exceptions, I have not found them, and the overhead of finding them is higher than the cost of just doing this switch-over.)
Configuration menu - View commit details
-
Copy full SHA for 90f78e7 - Browse repository at this point
Copy the full SHA 90f78e7View commit details -
Change how loader's
define
becomes visiblte to TSPreviously, this was defined as a global in `ember-template-compiler`. This was not really correct; it was a workaround for the way that the `loader` package defines it as a global as a side effect of importing and executing the module. Here, make it visible specifically *and only* to the root `ember` package, where it is needed for defining the type of the `Ember.__loader` object.
Configuration menu - View commit details
-
Copy full SHA for 06b7acb - Browse repository at this point
Copy the full SHA 06b7acbView commit details -
Add ability to manually copy
.d.ts
type modulesSome packages in the project supply `.d.ts` files which must be part of both the authoring-time types *and* the published types, because they represent values which become available at runtime by way of codegen. For example, the `ember/version` module provides a `VERSION` value derived from the package version. Both Ember's internals and the public API include this value in various ways, but it does not have a corresponding ES module on disk, so we provide a type definition representing where it *notionally* lives, and that type definition must also appear in the published types. In these cases, simply copy the file from an input to an output location, rather than trying to use `tsc` for them (since `tsc` will actually ignore them).
Configuration menu - View commit details
-
Copy full SHA for 22a100b - Browse repository at this point
Copy the full SHA 22a100bView commit details -
Provide an
owner-ext
for@ember/service
`owner-ext` is a pass-through type definition module which adds the `Registry` from `@ember/service` to the `DIRegistry` in `@ember/owner` in a way that works for both internal usage within Ember *and* usage by end users, given the constraints of our types publishing infrastructure and its need to wrap all proper modules in `declare module { }` blocks. Since this already *has* a `declare module { }` block, it does not need to be wrapped; and since it is simply a `.d.ts` file, we can copy it over rather than trying to emit it with `tsc` during build. (This is, admittedly, a hack: but a sadly necessary one given our constraints!)
Configuration menu - View commit details
-
Copy full SHA for 5da100d - Browse repository at this point
Copy the full SHA 5da100dView commit details -
Import a root without
/index
inember-template-compiler
Instead of working around this in the type publishing infrastructure (though we may ultimately want to do that as well), just *fix* it by normalizing the import to the more "normal" form without `/index`.
Configuration menu - View commit details
-
Copy full SHA for 6551040 - Browse repository at this point
Copy the full SHA 6551040View commit details -
The router service presently takes a generic
We should, separately, fix that: it doesn't actually make sense for the `RouterService` to be generic over a single route or even a set of routes, so we need to go back and undo that type-level plumbing.
Configuration menu - View commit details
-
Copy full SHA for e034e72 - Browse repository at this point
Copy the full SHA e034e72View commit details -
Update how we compile backburner.js' types
Use the full package name in both the broccoli build and all imports which reference it, so that the types can resolve to them correctly.
Configuration menu - View commit details
-
Copy full SHA for 80b738d - Browse repository at this point
Copy the full SHA 80b738dView commit details -
Publishing script: do not wrap passthrough copies
This makes it so we can write code for things like the `DIRegistry` which works correctly at both authoring and publishing time: it means the side-effect-type modules can be in "module mode" rather than purely ambient mode in both contexts. It also updates the definition of the `@ember/service/owner-ext.d.ts` to be in module mode.
Configuration menu - View commit details
-
Copy full SHA for c1f0073 - Browse repository at this point
Copy the full SHA c1f0073View commit details -
Correct the
@ember/application
type testThe previous test was overly generous, allowing users to pass anything into the `buildInstance()` call and not checking that it worked with the actual required arguments. This may technically be true, given how the Ember APIs for `.create()` work under the hood (and that is how this works, of course), but it's not *useful* to TS users, and it does not actually represent the expected public API.
Configuration menu - View commit details
-
Copy full SHA for 4e15f8b - Browse repository at this point
Copy the full SHA 4e15f8bView commit details -
Do not special-case ember-template-compiler/lib/types
These can go through the normal pipeline by being a `.ts` files instead of a `.d.ts` file in the source.
Configuration menu - View commit details
-
Copy full SHA for edbb768 - Browse repository at this point
Copy the full SHA edbb768View commit details -
Use
keyof this
inObservable
'sget
,set
, etc.This makes `this.get('foo')` and friends work in roughly the same cases where `get(this, 'foo')` and friends work.
Configuration menu - View commit details
-
Copy full SHA for 3917d20 - Browse repository at this point
Copy the full SHA 3917d20View commit details -
Emit named items for built-in components
The `Input` and `Textarea` components were previously being emitted as the direct result of the `opaquify` item, with no name. This made it impossible for TS to *automatically* emit them (a) with a useful import name or (b) with a nameable type. Introducing an intermediate binding and a type defined as the `typeof` the named constant, the combination of which becomes the default export, maintains the existing runtime behavior exactly while making the types name-able.
Configuration menu - View commit details
-
Copy full SHA for 3940d67 - Browse repository at this point
Copy the full SHA 3940d67View commit details -
Correctly handle router registration into service registry
Use the same pattern for this as for extending the DIRegistry with the service registry: create a passthrough copy of a module declaration which is valid in both authoring and publishing contexts.
Configuration menu - View commit details
-
Copy full SHA for 31cef6f - Browse repository at this point
Copy the full SHA 31cef6fView commit details -
Name the return type of (internal) controllerFor
This prevents us from needing to emit (rewritten) relative paths for the return type.
Configuration menu - View commit details
-
Copy full SHA for 632cb35 - Browse repository at this point
Copy the full SHA 632cb35View commit details -
Loosen restriction on service registry
Services can be any object, both in practice for today and in a future where Ember services don't have to have an Ember base class.
Configuration menu - View commit details
-
Copy full SHA for 6473757 - Browse repository at this point
Copy the full SHA 6473757View commit details -
Substantially refactor
publish.mjs
Introduce the ability to copy over hand-authored `.d.ts` files; Ember has a number of these for things which exist at runtime but have no corresponding authoring-time `.js`/`.ts` file, e.g. templates. Along the way, make a couple significant improvements: 1. Switch to using the async versions of most operations, which mildly improves performance. 2. Extract some of the functionality into well-scoped functions to show the flow more clearly, and to handle the common process of writing an error to the console and bailing.
Configuration menu - View commit details
-
Copy full SHA for 4408557 - Browse repository at this point
Copy the full SHA 4408557View commit details -
Fix types and type tests for
@ember/array
- `sortBy()` can accept multiple keys to sort on - Type tests should not name `EmberArray` as `Array` lest they confuse the difference with global (real!) `Array`. - Type tests should use public API imports, not private API imports.
Configuration menu - View commit details
-
Copy full SHA for 6e1472e - Browse repository at this point
Copy the full SHA 6e1472eView commit details -
Correct
@ember/object
type tests given improved safetyPreviously (i.e. on earlier versions of TS) we did not consistently get the type params preserving the underlying types as robustly, but we can now preserve this information.
Configuration menu - View commit details
-
Copy full SHA for 6dedf8b - Browse repository at this point
Copy the full SHA 6dedf8bView commit details -
Update
@ember/application
type tests for DI registryNow that the service registry provides a constraint of `object` for the entries, rather than no constraint whatsoever, we can update the tests to verify this to prevent regression.
Configuration menu - View commit details
-
Copy full SHA for ee42331 - Browse repository at this point
Copy the full SHA ee42331View commit details -
Handle type (un)safety of some runloop
bind
We can safely type *almost* all variants, but not using Ember's `bind` with `this` and a string name. Introduce an appropriate fallback for that case; this means that we cannot catch quite as many errors but in exchange we get coverage over documented patterns in Ember's code. (This gives us the same behavior as the preview and DT types always had as a fallback.)
Configuration menu - View commit details
-
Copy full SHA for 5d2db7e - Browse repository at this point
Copy the full SHA 5d2db7eView commit details -
Handle
declare namespace
in types publishing script`namespace` and `module` both introduce TS `ModuleDeclaration` types, so we distinguish between the two by checking whether it uses a string literal (rather than an identifier) when excluding `declare module` from the post-processing.
Configuration menu - View commit details
-
Copy full SHA for e596002 - Browse repository at this point
Copy the full SHA e596002View commit details
Commits on Apr 20, 2023
-
Refactor
Ember
namespace to be a TSnamespace
While the `namespace` construct is very much to be avoided for new code, it is *exactly* correct for the case of the `Ember` namespace, which is (precisely!) a namespace. To make this work: - Combine the existing `const PartialEmber` and `const Ember` object bindings into a single `namespace Ember`. - For the members assigned via `Object.defineProperty`, switch from an `interface` to `export declare let` and `export declare const` bindings on the `namespace`. Make sure to use `let` or `const` to match the readonly or writable semantics of the items defined thus. Testing this exposed that at some point `Ember.run.later` and similar nested namespace access stopped working, almost certainly at the point when we dropped support for the namespace access from the module, but our type tests still promised it. Noting that no *runtime* tests check for this, remove the corresponding type tests.
Configuration menu - View commit details
-
Copy full SHA for 2fdb3f5 - Browse repository at this point
Copy the full SHA 2fdb3f5View commit details -
Add top-level safe key list for
getProperties
This already works in the variant where the caller passes in an array, but we did not have the overload for where they pass in multiple args.
Configuration menu - View commit details
-
Copy full SHA for 7e5cc1a - Browse repository at this point
Copy the full SHA 7e5cc1aView commit details -
Provide a useful type for
@computed.meta()
Useful and *hopefully* accurate, but the implementation is a bit murky as to what the intended semantics are, and the commit history is not illuminating. This seems to capture the actual tested and documented behavior accurately.
Configuration menu - View commit details
-
Copy full SHA for 6385cea - Browse repository at this point
Copy the full SHA 6385ceaView commit details -
Extract owner and location side effect modules for routing/location
As with our service registry, we need these to live in separate files so they can be copied over without change and so be able to perform imports while *also* performing a module merge.
Configuration menu - View commit details
-
Copy full SHA for abc0c4e - Browse repository at this point
Copy the full SHA abc0c4eView commit details -
Dramatically simplify routing types, fix its type tests
Since we have no ability to connect or check, within Ember itself or in the things it provides to callers, the relationship between any given Route model, Transition, and the overall RouterState, remove those type parameters entirely in favor of just passing Ember's `Route` as the type directly to `router.js`'s type parameters. This lets us simplify the routing layer types considerably. Also update a number of the type tests for the routing layer to match Ember's actual behavior: the preview (and DT) types were simply wrong at various points.
Configuration menu - View commit details
-
Copy full SHA for d48f51e - Browse repository at this point
Copy the full SHA d48f51eView commit details -
Make cache-for slightly type-safer
Add an overload which correctly handles keyof lookups.
Configuration menu - View commit details
-
Copy full SHA for bdf9fcf - Browse repository at this point
Copy the full SHA bdf9fcfView commit details -
Update types and tests for Ember namespace
- Give onerror a useful type (the one it has always had). - Mark some exported items as private. - Update the test suite to reflect the types from source: in some cases looser, in other cases somewhat tighter!
Configuration menu - View commit details
-
Copy full SHA for 436d583 - Browse repository at this point
Copy the full SHA 436d583View commit details -
Configuration menu - View commit details
-
Copy full SHA for 229eb14 - Browse repository at this point
Copy the full SHA 229eb14View commit details -
Configuration menu - View commit details
-
Copy full SHA for afa3d97 - Browse repository at this point
Copy the full SHA afa3d97View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9f293e5 - Browse repository at this point
Copy the full SHA 9f293e5View commit details -
Configuration menu - View commit details
-
Copy full SHA for ccb1afa - Browse repository at this point
Copy the full SHA ccb1afaView commit details -
Fix types and type tests for
@ember/debug/data-adapter
- Introduce `Column` type and use it as appropriate. - Update type tests for the *actual* API: apparently DT had this wrong for many years.
Configuration menu - View commit details
-
Copy full SHA for 09f3b36 - Browse repository at this point
Copy the full SHA 09f3b36View commit details
Commits on Apr 24, 2023
-
Configuration menu - View commit details
-
Copy full SHA for cd91172 - Browse repository at this point
Copy the full SHA cd91172View commit details -
Fix types and type tests for @ember/debug
- `deprecate` and `warn` can be called without args (this is not the intended behavior, but it is currently legal in the internals). - `assert` needs to be typed correctly in the implementation to be `never` when no predicate is passed.
Configuration menu - View commit details
-
Copy full SHA for 5649f39 - Browse repository at this point
Copy the full SHA 5649f39View commit details
Commits on Apr 25, 2023
-
Configuration menu - View commit details
-
Copy full SHA for c203349 - Browse repository at this point
Copy the full SHA c203349View commit details -
Fix types for
assert
and(get|set)DebugFunction
- Update prod `noop` bindings to cast away safety. - Update type tests to expect `assert` to `asserts test` or be `never`.
Configuration menu - View commit details
-
Copy full SHA for 1d2e048 - Browse repository at this point
Copy the full SHA 1d2e048View commit details -
Configuration menu - View commit details
-
Copy full SHA for 23da1ea - Browse repository at this point
Copy the full SHA 23da1eaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 284ea81 - Browse repository at this point
Copy the full SHA 284ea81View commit details -
Configuration menu - View commit details
-
Copy full SHA for c9b410a - Browse repository at this point
Copy the full SHA c9b410aView commit details -
Add a required
as const
for Controller QPs type testTS helpfully tries to infer a mutually-compatible type when passed more than one object in an array (to allow narrowing etc.), but with QPs on a Controller, we actually do *not* want that behavior; so when passing both `type` and a rename in the same QPs config, use `as const`.
Configuration menu - View commit details
-
Copy full SHA for fde1a80 - Browse repository at this point
Copy the full SHA fde1a80View commit details -
Supply correct internal types for
precompileTemplate
Although this is a build-time-only API, which is ultimately removed from the distributed build, it is perfectly legal for Ember users to *name*, especially if doing their own build tooling work; as such, it needs to provide the types it has when used in the build.
Configuration menu - View commit details
-
Copy full SHA for 9923c7a - Browse repository at this point
Copy the full SHA 9923c7aView commit details -
Handle edge case in types publishing path mapping
Without this, some TS-generated `import()` types naming a given item where the runtime code simply relies on inference get emitted without the top-level `@ember/` namespace. This special case makes sure we do not drop that: if we ever find it, we know we *need* to emit it.
Configuration menu - View commit details
-
Copy full SHA for 0c2058d - Browse repository at this point
Copy the full SHA 0c2058dView commit details -
Configuration menu - View commit details
-
Copy full SHA for de0f67a - Browse repository at this point
Copy the full SHA de0f67aView commit details -
Update types and type tests for CP macros
- Correctly capture deprecation options. - Flag CP syntax we do not expect to work. - Make `@sort` less type-safe, to match `Array.prototype.sort`.
Configuration menu - View commit details
-
Copy full SHA for 2a1dd3e - Browse repository at this point
Copy the full SHA 2a1dd3eView commit details -
Simplify types for
(get|set)Properties
This fixes many of the incompatibilities from our type tests, and makes the resulting code *much* clearer at the same time. The key here is to move away from trying to use tuple spread types to just constraining the actual args and mapping their types into a `Pick` or `Record`.
Configuration menu - View commit details
-
Copy full SHA for 11f1ecf - Browse repository at this point
Copy the full SHA 11f1ecfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5d87525 - Browse repository at this point
Copy the full SHA 5d87525View commit details -
Eliminate cycle in definition of (Ember)
Component
`Component` uses `ViewSupport`, but `ViewSupport` defined its `this` as `Component`. This was a classic form of cycle which blocked supporting the `Mixin`-based programming model effectively with TS in the first place and was a major motivator for investing in native classes back in the early Ember 3.x days! here, the fix is to use `this: CoreView` instead so that `ViewSupport` does not need to name `Component`, only the chunk of `Component`'s base types it actually uses. As a bonus, remove a needless `extends FrameworkObject` from the merge on the interface of the `CoreView` class, since normal inheritance does correctly preserve that.
Configuration menu - View commit details
-
Copy full SHA for a2e42e1 - Browse repository at this point
Copy the full SHA a2e42e1View commit details -
Fix/simplify types of
create
,reopen
, andreopenClass
As described in the RFC, we do not want to attempt to provide the type- modifying capabilities of these functions. The result is type safe but not especially useful, but that is as we want: using `create` to provide values not on the base type *or* to change its values is quite undesirable; and using `reopen` and `reopenClass` to dynamically update instance and static members of a class has serious (and not obvious!) performance downsides and discoverability problems for maintainers, and will ultimately be deprecated entirely as part of removing Classic. A key result is that `.create()` now allows *any* props to be set, but does not update the resulting type. This is an unfortunate necessity given how Ember *itself* uses `.create()`.
Configuration menu - View commit details
-
Copy full SHA for 341e356 - Browse repository at this point
Copy the full SHA 341e356View commit details -
Configuration menu - View commit details
-
Copy full SHA for f70771d - Browse repository at this point
Copy the full SHA f70771dView commit details -
Remove now-defunct types for
(add|remove)Listener
Ember's own types are now less generous about `evented`'s `addListener` and `removeListener` functions than the preview/DT types were, because Ember's implementation has been simplified and the types had not been updated to match.
Configuration menu - View commit details
-
Copy full SHA for 284f6db - Browse repository at this point
Copy the full SHA 284f6dbView commit details -
Configuration menu - View commit details
-
Copy full SHA for b3af348 - Browse repository at this point
Copy the full SHA b3af348View commit details -
Remove extranes
extends
fromEmberObject
interfaceAgain, this already correctly `extends CoreObject` because the class itself does so; we only need to merge in declarations with mixins.
Configuration menu - View commit details
-
Copy full SHA for 35251ec - Browse repository at this point
Copy the full SHA 35251ecView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3b320c0 - Browse repository at this point
Copy the full SHA 3b320c0View commit details -
Configuration menu - View commit details
-
Copy full SHA for b94db2c - Browse repository at this point
Copy the full SHA b94db2cView commit details -
Provide type safe get and set in ObjectProxy
While people should generally move away from this and to native `Proxy` this makes it possible for existing code to be well-typed.
Configuration menu - View commit details
-
Copy full SHA for 294e401 - Browse repository at this point
Copy the full SHA 294e401View commit details -
Configuration menu - View commit details
-
Copy full SHA for dd37b6c - Browse repository at this point
Copy the full SHA dd37b6cView commit details -
Fix
@ember/object
tests for proxy and observableAccount for both the improved `Proxy` type safety and the removed `CoreObject.create` type safety in the type tests.
Configuration menu - View commit details
-
Copy full SHA for a17d279 - Browse repository at this point
Copy the full SHA a17d279View commit details -
Fix bad import and reference in ember NS type tests
These referred respectively to imports which existed only in DT/preview types and a removed API!
Configuration menu - View commit details
-
Copy full SHA for 6694ed7 - Browse repository at this point
Copy the full SHA 6694ed7View commit details -
Partially reimplement type-safe
.create()
This gets us a *small* amount of type safety, rather than absolutely none: it does not check the types passed into `.create()` match, but since there is little reason to directly call this for end user code (vs. for internal code, which actually uses this dynamic capability!), this gives us the actual runtime behavior: if you smash a property with a new type, you... do.
Configuration menu - View commit details
-
Copy full SHA for 86eeaf7 - Browse repository at this point
Copy the full SHA 86eeaf7View commit details -
Correctly export both sides of the opaque LinkTo
Even though we have an "opaque" class here, we still need to make sure both the static type of the class and its runtime type are available to callers to name.
Configuration menu - View commit details
-
Copy full SHA for 2fd539a - Browse repository at this point
Copy the full SHA 2fd539aView commit details -
Update a
set()
type test: it allows dynamic settingThis matches the runtime behavior. We do not catch setting things this way, as a result, but in a world where native property access works everywhere, this is actually somewhat useful: it means you can set anything on a target object, and although the type will not be updated with that change, it will at least type check in a way that matches the dynamic runtime behavior.
Configuration menu - View commit details
-
Copy full SHA for dd907e9 - Browse repository at this point
Copy the full SHA dd907e9View commit details -
Remove a type test which only covered internals
This was useful to prevent us from regression in the DT/preview types era, but these are covered by Ember's internals being required to type check as part of CI now, and we have also simplified or removed most of this machinery.
Configuration menu - View commit details
-
Copy full SHA for 972a9e1 - Browse repository at this point
Copy the full SHA 972a9e1View commit details -
Update type tests for improved
set
/get
inferenceThe resulting types are just records, where `Pick` preserves some extra info because of the dynamic class behavior.
Configuration menu - View commit details
-
Copy full SHA for ffb0501 - Browse repository at this point
Copy the full SHA ffb0501View commit details -
Drop
Ember.get
from Ember Router testsThe fact that `Ember.get` gets very confused on deeply mapped types combined with `this` types is not surprising, but is also not relevant to a test where no one *should* use `get()` instead of normal property access.
Configuration menu - View commit details
-
Copy full SHA for 8d80667 - Browse repository at this point
Copy the full SHA 8d80667View commit details -
Further remove generic Route param from router
As with the earlier commit removing some of this, we have no ability to check these types, so they are just extraneous overhead.
Configuration menu - View commit details
-
Copy full SHA for 26f16cb - Browse repository at this point
Copy the full SHA 26f16cbView commit details -
Fix types for internal-test-helpers
Now that `create` can catch this, it lets us know about our own lies.
Configuration menu - View commit details
-
Copy full SHA for caf4b1d - Browse repository at this point
Copy the full SHA caf4b1dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4799725 - Browse repository at this point
Copy the full SHA 4799725View commit details
Commits on Apr 26, 2023
-
Improve correctness and usability of
@ember/modifier
types- Re-export the relevant types from `@glimmer/interfaces` as well as wiring them up to the appropriate points in the exported functions. - Add the hooks necessary to make the exported `on` modifier visible to Glint, including adding an `Opaque` internal type.
Configuration menu - View commit details
-
Copy full SHA for be2596f - Browse repository at this point
Copy the full SHA be2596fView commit details -
Improve types and type tests for
@ember/test
- Provide the correct type for the first param for the callback passed to `registerHelper()`. - Add a cast and an explanation for type test on `TestAdapter`
Configuration menu - View commit details
-
Copy full SHA for cb8f6fd - Browse repository at this point
Copy the full SHA cb8f6fdView commit details -
Configuration menu - View commit details
-
Copy full SHA for a0ab50f - Browse repository at this point
Copy the full SHA a0ab50fView commit details -
Configuration menu - View commit details
-
Copy full SHA for ad9e569 - Browse repository at this point
Copy the full SHA ad9e569View commit details -
Configuration menu - View commit details
-
Copy full SHA for 142d5d1 - Browse repository at this point
Copy the full SHA 142d5d1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 06c3a14 - Browse repository at this point
Copy the full SHA 06c3a14View commit details -
Add
static positionalParams
type declaration to EmberComponentWithout this, neither `.extend()`ing `Component` nor the documented `reopenClass` pattern works with `positionalParams`.
Configuration menu - View commit details
-
Copy full SHA for 40722d2 - Browse repository at this point
Copy the full SHA 40722d2View commit details -
Configuration menu - View commit details
-
Copy full SHA for ef18c84 - Browse repository at this point
Copy the full SHA ef18c84View commit details -
Fix types around component templates and TOCs
- Make `templateOnlyComponent` and associated types usable with Glint the same way the preview types were. - Fix the way we name the types of `setComponentTemplate` in tests. In the real world, the way to get the type is via calling another public API; here we just want to make sure the function *requires* the correct thing.
Configuration menu - View commit details
-
Copy full SHA for 08296c6 - Browse repository at this point
Copy the full SHA 08296c6View commit details
Commits on Apr 28, 2023
-
Fix types and type tests for
@ember/test
- Do not emit `| () => never` for functions in `@ember/test`: while it is true that those *will* error if `ember-testing` is not included, the underlying function type is still correct even there, since the immediately-throwing handler is a legitimate function subtype of the expected behavior when the library *is* included. Additionally, that inclusion is normally a build-time concern. - Apply some formatting tweaks to the definition of `registerWaiter`'s implementation definition and `prettier-ignore` those lines to make it more legible. - Update a `register` call in a type test to use a proper 'full:name'.
Configuration menu - View commit details
-
Copy full SHA for e57bc26 - Browse repository at this point
Copy the full SHA e57bc26View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d65d25 - Browse repository at this point
Copy the full SHA 9d65d25View commit details -
Make Ember's helper types Glint-compatible
Provide the same public API as the preview types. This requires lying a bit about the return type of `helper()` in particular, but no part of Ember's own internals cares about the details: they are relevant *only* as the point where they are actually created. The provided type avoids a number of possible kinds of errors by providing an opaque item which cannot be constructed but which *does* preserve generics. Moreover, the actual details of type returned by `helper()` are *not* public API, so this correctly avoids exposing those details. As a bonus, remove a number of extra internal type aliases on both the source and that were used in the preview types.
Configuration menu - View commit details
-
Copy full SHA for 911e14c - Browse repository at this point
Copy the full SHA 911e14cView commit details -
Configuration menu - View commit details
-
Copy full SHA for c0f010c - Browse repository at this point
Copy the full SHA c0f010cView commit details -
Fix types for template-only components
- Do not expose Glimmer's private/internal notion of a template-only component, even for type tests. - Do provide the full *call* API for Glimmer's `templateOnly()`.
Configuration menu - View commit details
-
Copy full SHA for 5b397e1 - Browse repository at this point
Copy the full SHA 5b397e1View commit details -
Fix re-export of
Ember.RSVP
as anamespace
This syntax is namespace-specific: `import` in a namespace is aliasing one namespace to another, while `export` marks the item public on the namespace (as with the rest of the exported items).
Configuration menu - View commit details
-
Copy full SHA for 40b3a19 - Browse repository at this point
Copy the full SHA 40b3a19View commit details -
Configuration menu - View commit details
-
Copy full SHA for 05acc98 - Browse repository at this point
Copy the full SHA 05acc98View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2f26a2c - Browse repository at this point
Copy the full SHA 2f26a2cView commit details
Commits on May 1, 2023
-
Remove assertion from build-owner internal test helper
At the moment, some *tests* pass no resolver, and expect this to work anyway. The fix is to have those tests pass a test-friendly resolver and then this will work as expected.
Configuration menu - View commit details
-
Copy full SHA for 73dc0cd - Browse repository at this point
Copy the full SHA 73dc0cdView commit details -
Fix a missed rename in
ember/index.ts
Supporting the TS `namespace` export for the `Ember` namespace object (in 2fdb3f5) required aliasing many of the imports; one of these was hidden by having a `@ts-expect-error` on that statement for unrelated reasons.
Configuration menu - View commit details
-
Copy full SHA for f55cc15 - Browse repository at this point
Copy the full SHA f55cc15View commit details -
Update Ember NS reexport test for backburner.js
The existence of the `_Backburner` re-export is of a private item, and this test simply checks that the re-export works as expected; sinc we updated the build pipeline not to do the weird renaming shenanigans it did previously to make `'backburner'` the import downstream, we can update this test to match the actual Node-resolveable location as well (see 80b738d for background).
Configuration menu - View commit details
-
Copy full SHA for 3f54dc7 - Browse repository at this point
Copy the full SHA 3f54dc7View commit details -
Add private runloop backburner re-exports
`@ember/test-helpers` uses these as they exist in the DT and preview types, so to avoid breaking that, re-supply them here. They should not be relied upon long-term, but this allows us to migrate the library's dependency chain distinctly from the release of these types.
Configuration menu - View commit details
-
Copy full SHA for 2f826a3 - Browse repository at this point
Copy the full SHA 2f826a3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 544d381 - Browse repository at this point
Copy the full SHA 544d381View commit details
Commits on May 4, 2023
-
Fix typo in comment in broccoli/packages.js
Co-authored-by: Dan Freeman <dfreeman@salsify.com>
Configuration menu - View commit details
-
Copy full SHA for 9fd1b03 - Browse repository at this point
Copy the full SHA 9fd1b03View commit details -
Do not duplicate work on hand-written
.d.ts
filesThere are three categories of `.d.ts` files we manually copy over as part of our publishing process: - `*-ext.d.ts` modules, which supply module merge declarations manually to allow the regular module to go through the normal postprocessing chain while still allowing the imports to work correctly for the declaration merge. These must be copied over and left exactly as they are, no post-processing. - Modules which correctly represent a runtime-only location of an API, which appear at one point in the source graph, but must be emitted at a completely different location for runtime/import. These must be copied over and left as they are, no post-processing, but targeting a different location to emit them. - Modules which must be copied over and then post-processed, because they represent runtime-only code which must be importable as a normal module via a relative path *and* must be wrapped in `declare module` to be usable in the emitted types. Separate those pieces of functionality, extract a module-scope list for the latter two, and rename the local functions accordingly.
Configuration menu - View commit details
-
Copy full SHA for 2287751 - Browse repository at this point
Copy the full SHA 2287751View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4bc5d73 - Browse repository at this point
Copy the full SHA 4bc5d73View commit details -
Export built-in components as interfaces for Glint
Instead of `typeof`, export `interface` types which can be merged with by Glint, and which are kept distinct from each other with the `Opaque` utility type, while preserving `OpaqueInternalComponentConstructor`.
Configuration menu - View commit details
-
Copy full SHA for 22276b5 - Browse repository at this point
Copy the full SHA 22276b5View commit details -
Mark internal
Route
details with@internal
This does not affect type checking, but since theses items will now be exposed to consumers, at least explicitly signal via their docs (seen on hover etc.) that they should not be used.
Configuration menu - View commit details
-
Copy full SHA for b7a7a57 - Browse repository at this point
Copy the full SHA b7a7a57View commit details -
Fix typo in description of
Opaque
Co-authored-by: Dan Freeman <dfreeman@salsify.com>
Configuration menu - View commit details
-
Copy full SHA for ae6d85d - Browse repository at this point
Copy the full SHA ae6d85dView commit details -
Fix typo in comment explaining abstract class for helper
Co-authored-by: Dan Freeman <dfreeman@salsify.com>
Configuration menu - View commit details
-
Copy full SHA for 824a3b6 - Browse repository at this point
Copy the full SHA 824a3b6View commit details -
Provide default type for Signatures etc. in Ember NS
Without these, anyone using them directly as a type will get a type error reporting that they are missing.
Configuration menu - View commit details
-
Copy full SHA for e572863 - Browse repository at this point
Copy the full SHA e572863View commit details -
Explicitly type test fallback path for runloop
bind
This type test will let us know if we change that behavior, rather than indicating that it is the *desired* behavior.
Configuration menu - View commit details
-
Copy full SHA for 19b31a3 - Browse repository at this point
Copy the full SHA 19b31a3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1038406 - Browse repository at this point
Copy the full SHA 1038406View commit details
Commits on May 5, 2023
-
Publicly export
FunctionBasedHelperInstance
This abstract class -- specifically, its `protected abstract __concrete__` member -- prevents subclasses from doing `class X extends helper(..)`, since that is an error at runtime. While it is rare that people would type that, it is not impossible and we use this to give them early signal via the types for a behavior which will break (and in a somewhat inscrutable way!) at runtime. This is needful because we lie about what this actually is for Glint's sake: a function-based helper returns a `Factory<SimpleHelper>`, which is designed to be "opaque" from a consumer's POV, i.e. not user-callable or constructible but only useable in a template (or via `invokeHelper()` which also treats it as a fully opaque `object` from a type POV). But Glint needs a `Helper<S>` to make it work the same way as class-based helpers. (Note that this does not hold for plain functions as helpers, which it can handle distinctly.) This signature thus makes it so that the item is usable *as* a `Helper` in Glint, but without letting end users treat it as a helper class instance. Long-term, this entire construct can go away in favor of deprecating the `helper()` invocation in favor of using plain functions.
Configuration menu - View commit details
-
Copy full SHA for c725cdc - Browse repository at this point
Copy the full SHA c725cdcView commit details -
Move
@glimmer/*
packages todependencies
This is one step along the path toward making Ember's `@glimmer/*` dependencies work as normal dependencies without pre-building them into an Ember distribution, but it is introduced *here* because consumers cannot use Ember's types as built from source without types from the many `@glimmer` packages Ember uses as part of both its internals and its public APIs. Moving these to `dependencies` will *not* change the build behavior: we will continue to pre-build Ember from these dependencies for now, so the actual output consumers receive should not be altered by this. The only change from a consumer's POV will be that they *do* get all the `@glimmer/*` packages as part of their installation of `ember-source` and therefore will be able to use the types. Later work can continue to tackle the broader build questions.
Configuration menu - View commit details
-
Copy full SHA for f3fa810 - Browse repository at this point
Copy the full SHA f3fa810View commit details -
Move backburner.js and router_js to
dependencies
As with the `@glimmer/*` packages, these must be present for TS users to be able to use Ember's types as published from source, since those types explicitly depend on and in some cases directly re-export these.
Configuration menu - View commit details
-
Copy full SHA for f0e501d - Browse repository at this point
Copy the full SHA f0e501dView commit details -
Move
route-recognizer
todependencies
As with the other packages moved this way (see immediately preceding commits), this must be in `dependencies` so that it is present for consumers to use its types.
Configuration menu - View commit details
-
Copy full SHA for 4827457 - Browse repository at this point
Copy the full SHA 4827457View commit details
Commits on May 8, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 164920b - Browse repository at this point
Copy the full SHA 164920bView commit details