Skip to content

fix: use output filename in TypeScript usage imports#2948

Merged
schani merged 2 commits into
glideapps:masterfrom
AysajanE:northset/M-105
Jul 19, 2026
Merged

fix: use output filename in TypeScript usage imports#2948
schani merged 2 commits into
glideapps:masterfrom
AysajanE:northset/M-105

Conversation

@AysajanE

Copy link
Copy Markdown
Contributor

Summary

Use the requested output filename in generated TypeScript usage imports instead of the hard-coded ./file module, with a focused regression.

Change

  • packages/quicktype-core/src/language/JavaScript/JavaScriptRenderer.ts
  • packages/quicktype-core/src/language/TypeScriptFlow/FlowRenderer.ts
  • packages/quicktype-core/src/language/TypeScriptFlow/TypeScriptFlowBaseRenderer.ts
  • packages/quicktype-core/src/language/TypeScriptFlow/TypeScriptRenderer.ts
  • test/unit/typescript-output-filename.test.ts

Checks

  • npm run test:unit -- test/unit/typescript-output-filename.test.ts — passed in a network-isolated container.
  • npm run lint — passed in a network-isolated container.
  • npm run build — passed in a network-isolated container.

Fixes #971


AI assistance was used; I reviewed and own this change.

Verification

Northset proof-of-pass receipt M-105
Contributor self-run; not maintainer verification.

AysajanE and others added 2 commits July 16, 2026 12:55
Signed-off-by: Aysajan Eziz <aeziz@northset.ai>
The previous commit only applied the output-filename-derived module name
to the TypeScript usage import comment; JavaScript (and Flow, which
inherits it) still emitted require("./file"). Hoist the module-name
derivation into a shared usageModuleName helper on JavaScriptRenderer,
use it in both the JavaScript require comment and the TypeScript import
comment, and extend the unit test to cover JavaScript, Flow, and the
stdout fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@schani
schani merged commit c9f675f into glideapps:master Jul 19, 2026
24 checks passed
@schani

schani commented Jul 19, 2026

Copy link
Copy Markdown
Member

Thank you for your contribution!

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

Successfully merging this pull request may close these issues.

Incorrect filename in comment in TS output

2 participants