Skip to content

Reexport TypeScript types#3589

Open
ddbeck wants to merge 3 commits intoweb-platform-dx:mainfrom
ddbeck:1980-export-types
Open

Reexport TypeScript types#3589
ddbeck wants to merge 3 commits intoweb-platform-dx:mainfrom
ddbeck:1980-export-types

Conversation

@ddbeck
Copy link
Copy Markdown
Collaborator

@ddbeck ddbeck commented Dec 1, 2025

This fixes two issues with the types we use in web-features:

  • Types aren't exported, which makes it inconvenient to write code the conforms to web-features's types
  • The types rely on a specific tsconfig, which fails type checking in some configurations.

Fixes #1980. See also Jym77/web-features-ts-esm, which was essential for fixing these issues.

If you want to try this version of the package, check out this branch and follow steps along these lines.
npm install
npm run build
cd packages/web-features
npm pack --pack-destination=$SOME_PACKAGE_WORKSPACE
cd $SOME_PACKAGE_WORKSPACE
npm install web-features-3.*.tgz
# do something with the package, e.g., npm test

Thanks to @Jym77 for the reproduction: https://github.com/Jym77/web-features-ts-esm

Co-authored-by: Jean-Yves Moyen <19969498+Jym77@users.noreply.github.com>
@ddbeck ddbeck force-pushed the 1980-export-types branch from 4c63e79 to 5b2dc4e Compare December 1, 2025 17:50
@ddbeck ddbeck marked this pull request as ready for review December 10, 2025 18:27
@ddbeck ddbeck marked this pull request as draft December 10, 2025 18:32
@ddbeck ddbeck marked this pull request as ready for review March 27, 2026 14:31
@ddbeck ddbeck added the minor version required This PR requires a minor version semver release (vX.Y+1.0) label Mar 27, 2026
@ddbeck
Copy link
Copy Markdown
Collaborator Author

ddbeck commented Apr 9, 2026

These are the names we would export if we merged this PR:

// Passthrough types
export type {
  BaselineHighLow,
  BrowserData,
  Browsers,
  Discouraged,
  GroupData,
  Release,
  SnapshotData,
  Support,
};


export interface Status extends QuicktypeStatus {
  baseline: false | BaselineHighLow;
}


export interface SupportStatus extends QuicktypeStatusHeadline {
  baseline: false | BaselineHighLow;
}

export interface WebFeaturesData extends Pick<
  QuicktypeWebFeaturesData,
  "browsers" | "groups" | "snapshots"
> {
  features: {
    [key: string]: FeatureData | FeatureMovedData | FeatureSplitData;
  };
}

export type FeatureData = { kind: "feature" } & Required<
  Pick<
    QuicktypeMonolithicFeatureData,
    "description_html" | "description" | "name" | "spec" | "status"
  >
> &
  Partial<
    Pick<
      QuicktypeMonolithicFeatureData,
      "caniuse" | "compat_features" | "discouraged" | "group" | "snapshot"
    >
  >;

export interface FeatureMovedData extends Omit<
  FeatureRedirectData,
  "redirect_targets"
> {
  kind: "moved";
}

export interface FeatureSplitData extends Omit<
  FeatureRedirectData,
  "redirect_target"
> {
  kind: "split";
}

export type BrowserIdentifier = keyof Browsers;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor version required This PR requires a minor version semver release (vX.Y+1.0) package:web-features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

web-features doesn't export types gracefully

1 participant