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

Introduce infra to publish stable types #20275

Merged
merged 9 commits into from
Nov 22, 2022
Merged

Commits on Nov 22, 2022

  1. Avoid exposing OWNER from @glimmer/owner

    There are pre-existing runtime shenanigans in `@ember/object/internals`
    to add debug-only errors to the class in dev builds. Those runtime
    shenanigans produce the need for type-level shenanigans to match: TS
    gets stuck here because the runtime shenanigans declare
    `FrameworkObject` with a class expression (rather than the usual class
    declaration form). That in turn means TS needs to be able to fully name
    the type produced by the clsas expression, which includes the `OWNER`
    symbol from `@glimmer/owner`.
    
    By explicitly giving the declaration a type when assigning it the class
    expression, instead of relying on inference, TS no longer needs to name
    the `OWNER` property key from the super class, eliminating the private
    name shenanigans.
    
    Co-authored-by: Dan Freeman <dfreeman@salsify.com>
    chriskrycho and dfreeman committed Nov 22, 2022
    Configuration menu
    Copy the full SHA
    9c4962b View commit details
    Browse the repository at this point in the history
  2. Refactor tsconfigs to share compiler options

    This lets each config specify *only* how it actually does a build (or
    not!), while sharing the config explicitly.
    
    It also fixes an existing bug in the compilation settings which was not
    affecting *normal* TS compilation with `tsc`, but was generating noise
    in the `broccoli-typescript-compiler` pipeline because the packages
    happened to be resolved in a different order such that the `loader`
    "package" definition, and its declaration of the `require` module, was
    not present in the graph. Set it explicitly in `compilerOptiosn.paths`
    to fix that.
    chriskrycho committed Nov 22, 2022
    Configuration menu
    Copy the full SHA
    4e62cd6 View commit details
    Browse the repository at this point in the history
  3. Introduce a script to publish stable types

    Provide a script which runs the compiler against a new tsconfig for
    generating types, wraps all the generated modules in `declare module`
    statements, and then creates an `index.d.ts` which uses side-effect
    style imports to expose them all, just the same as the preview types
    but generated from source.
    
    Critically, this infrastructure does not expose *any* stable types in
    and of itself. Instead, it introduces a list of all the types still in
    preview mode which acts as a filter, and currently *all* modules are in
    that filter. Stabilizing the types for a given module will mean
    removing modules from that list and removing the corresponding preview
    types definitions.
    chriskrycho committed Nov 22, 2022
    Configuration menu
    Copy the full SHA
    845b60e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    752f133 View commit details
    Browse the repository at this point in the history
  5. Update module-level documentation for preview types

    Align the text with the module docs for the stable types, clarifying
    the updated current status.
    chriskrycho committed Nov 22, 2022
    Configuration menu
    Copy the full SHA
    63e59ca View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    24c0e4a View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    f37f561 View commit details
    Browse the repository at this point in the history
  8. Fix typo in internal comments for @ember/object

    Co-authored-by: Dan Freeman <dfreeman@salsify.com>
    chriskrycho and dfreeman authored Nov 22, 2022
    Configuration menu
    Copy the full SHA
    7bef314 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    26a0923 View commit details
    Browse the repository at this point in the history