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

Published generator typings are wrong #7652

Closed
4 tasks done
cpcallen opened this issue Nov 16, 2023 · 0 comments
Closed
4 tasks done

Published generator typings are wrong #7652

cpcallen opened this issue Nov 16, 2023 · 0 comments
Assignees
Labels
component: generators issue: bug Describes why the code or behaviour is wrong

Comments

@cpcallen
Copy link
Contributor

cpcallen commented Nov 16, 2023

Problem

At the moment we are shipping hand-written .d.ts files for the generators which are pretty deficient. For example, javacript.d.ts (copied into the package from typings/javascript.d.ts) is essentially:

export enum Order {
  ATOMIC = 0,            // 0 "" ...
  // etc.
  NONE = 99,             // (...)
}

export declare const javascriptGenerator: any;

Note that javascriptGenerator is declared as any, and JavascriptGenerator is not declared at all.

This means that developers using generators from TypeScript are not getting the full benefit of TS's type checking of the generator classes / instances.

Proposed Solution

Publish the .d.ts files produced by tsc instead of these handwritten versions.

Discussion

  • Should we publish individual .d.ts files in dist/generators/**/*.d.ts (as we do for files in core), with a wrapper that just imports them, or should we try to publish a single file per chunk that rolls these up?
    • There may be some difficult in publishing a roll up as it will need to reference CodeGenerator, which is currently defined in core/.

See also #5818.

@cpcallen cpcallen added issue: bug Describes why the code or behaviour is wrong issue: triage Issues awaiting triage by a Blockly team member component: generators labels Nov 16, 2023
@maribethb maribethb removed the issue: triage Issues awaiting triage by a Blockly team member label Nov 16, 2023
@cpcallen cpcallen self-assigned this Nov 17, 2023
@cpcallen cpcallen closed this as completed Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: generators issue: bug Describes why the code or behaviour is wrong
Projects
None yet
Development

No branches or pull requests

2 participants