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

@schemastore/package types are invalid #680

Closed
G-Rath opened this issue Feb 24, 2023 · 3 comments
Closed

@schemastore/package types are invalid #680

G-Rath opened this issue Feb 24, 2023 · 3 comments

Comments

@G-Rath
Copy link

G-Rath commented Feb 24, 2023

v0.0.7 has now this:

/**
 * Used to specify conditional exports, note that Conditional exports are unsupported in older environments, so it's recommended to use the fallback array option if support for those environments is a concern.
 */
export interface PackageExportsEntryObject {
  /**
   * The module path that is resolved when this specifier is imported as a CommonJS module using the `require(...)` function.
   */
  require?: PackageExportsEntry | PackageExportsFallback;
  /**
   * The module path that is resolved when this specifier is imported as an ECMAScript module using an `import` declaration or the dynamic `import(...)` function.
   */
  import?: PackageExportsEntry | PackageExportsFallback;
  /**
   * The module path that is resolved when this environment is Node.js.
   */
  node?: PackageExportsEntry | PackageExportsFallback;
  /**
   * The module path that is resolved when no other export type matches.
   */
  default?: PackageExportsEntry | PackageExportsFallback;
  /**
   * The module path that is resolved when this environment matches the property name.
   *
   * This interface was referenced by `PackageExportsEntryObject`'s JSON-Schema definition
   * via the `patternProperty` "^(?![\.0-9]).".
   *
   * This interface was referenced by `PackageExportsEntryObject1`'s JSON-Schema definition
   * via the `patternProperty` "^(?![\.0-9]).".
   */
  [k: string]: PackageExportsEntry | PackageExportsFallback;
}
/**
 * Used to specify conditional exports, note that Conditional exports are unsupported in older environments, so it's recommended to use the fallback array option if support for those environments is a concern.
 */
export interface PackageExportsEntryObject1 {
  /**
   * The module path that is resolved when this specifier is imported as a CommonJS module using the `require(...)` function.
   */
  require?: PackageExportsEntry | PackageExportsFallback;
  /**
   * The module path that is resolved when this specifier is imported as an ECMAScript module using an `import` declaration or the dynamic `import(...)` function.
   */
  import?: PackageExportsEntry | PackageExportsFallback;
  /**
   * The module path that is resolved when this environment is Node.js.
   */
  node?: PackageExportsEntry | PackageExportsFallback;
  /**
   * The module path that is resolved when no other export type matches.
   */
  default?: PackageExportsEntry | PackageExportsFallback;
  /**
   * The module path that is resolved when this environment matches the property name.
   *
   * This interface was referenced by `PackageExportsEntryObject`'s JSON-Schema definition
   * via the `patternProperty` "^(?![\.0-9]).".
   *
   * This interface was referenced by `PackageExportsEntryObject1`'s JSON-Schema definition
   * via the `patternProperty` "^(?![\.0-9]).".
   */
  [k: string]: PackageExportsEntry | PackageExportsFallback;
}

Which is not valid because the index type does not allow undefined - the easiest and most accurate fix would be to drop the properties.

TS playground link

@ffflorian
Copy link
Owner

Thanks @G-Rath! I really need to implement the TypeScript check for generated schemas 😄

Fixed in b688522.

@G-Rath
Copy link
Author

G-Rath commented Jul 13, 2023

@ffflorian this has regressed in v0.0.9

@ffflorian
Copy link
Owner

Fixed (again) with 81538b6 and published to v0.0.10.

Thanks @G-Rath!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants