Skip to content

Create typescript tests for apis #2480

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

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

tewaro
Copy link
Contributor

@tewaro tewaro commented Aug 6, 2024

No description provided.

@tewaro tewaro requested review from a team as code owners August 6, 2024 04:48
@tewaro tewaro mentioned this pull request Aug 6, 2024
Copy link
Contributor

@hoodmane hoodmane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @AdityaAtulTewari.

data = data + [src, "//src/workerd/server:workerd"]
data = data + [src, "//src/workerd/server:workerd"] + srcs

ts_srcs = [src for src in srcs if src.endswith(".ts")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you need the new srcs argument at all? Why not just filter data for arguments that end in *.ts? It seems simpler to me.

Copy link
Contributor Author

@tewaro tewaro Aug 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Honestly it was cleaner to help me debug at first, I can collapse them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the failure look like if there is a type error? Would it be possible to add a test_ts_testing that forces a type error and asserts that it looks correct? Or did you manually verify this?

It looks to me like type errors generate build errors rather than test failures. Ideally we should probably use tsc --noCheck at build time and run tsc --noEmit as part of the test. But annoyingly, it looks like the --noCheck CLI option is only going to be released as part of typescript v5.6:
microsoft/TypeScript#58839

So maybe we can add this as a TODO for when typescript 5.6 comes out.

Copy link
Contributor Author

@tewaro tewaro Aug 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • That makes sense I can add that todo

@tewaro tewaro force-pushed the AdityaAtulTewari/typescript-tests-for-apis branch from 8ad05a6 to 0d67399 Compare August 6, 2024 16:47
@tewaro tewaro requested a review from hoodmane August 6, 2024 16:47
@tewaro tewaro force-pushed the AdityaAtulTewari/typescript-tests-for-apis branch from 0d67399 to 05a6ecf Compare August 6, 2024 18:02
@tewaro tewaro merged commit dd7e463 into main Aug 6, 2024
9 checks passed
@tewaro tewaro deleted the AdityaAtulTewari/typescript-tests-for-apis branch August 6, 2024 19:29
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.

2 participants