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

refactor(generators): Migrate Python generators to TypeScript #7617

Merged
merged 5 commits into from
Nov 11, 2023

Conversation

cpcallen
Copy link
Contributor

The basics

The details

Resolves

Part of #6828.

Proposed Changes

Migrate generators/python/*.js and generators/python.js to TypeScript.

Reason for Changes

Finish TS migration.

Test Coverage

npm test passes. No changes to manual test procedures required.

Documentation

No changes to documentation yet, as there should be minimal changes to the generated code and no changes to the published typings (because during build we overwrite the generated .d.ts files with the ones from typings/).

Additional Information

It may be easier to review this commit-by-commit, as the final format commit make a lot of noisy changes.

First pass doing very mechanistic migration, not attempting to fix
all the resulting type errors.
This consists almost entirely of adding casts, so the code output
by tsc should be as similar as possible to the pre-migration .js
source files.
The way the generator functions are added to
pythonGenerator.forBlock has been modified so that incorrect
generator function signatures will cause tsc to generate a type
error.
One block protected with // prettier-ignore to preserve careful
comment formatting.

Where there are repeated concatenations prettier has made a pretty
mess of things, but the correct fix is probably to use template
literals instead (rather than just locally disabling prettier).
This is one of the items in the to-do list in google#7600.
@cpcallen cpcallen merged commit b418907 into google:develop Nov 11, 2023
@cpcallen cpcallen deleted the refactor/6828/python branch November 11, 2023 18:03
@cpcallen cpcallen changed the title refactor(generators): Migrate Python generators to TypeScript #7602 refactor(generators): Migrate Python generators to TypeScript Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants