-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: Web core test and CI workflow fixes #1000
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
Changes from 1 commit
89778c8
72fa29d
81da39f
a1f52f0
789fc42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -107,8 +107,8 @@ describe('InferredComponentApiSchemaType', () => { | |||||
| name: 'MockComp', | ||||||
| schema: mockSchema, | ||||||
| } satisfies ComponentApi; | ||||||
| // Appease typescript-eslint/no-unused-vars | ||||||
| type _ = typeof mockApi; | ||||||
|
|
||||||
| assert.ok(mockApi); | ||||||
|
|
||||||
| // Type-level equivalence assertion using z.infer | ||||||
| type ExpectedType = z.infer<typeof mockSchema>; | ||||||
|
|
@@ -120,6 +120,7 @@ describe('InferredComponentApiSchemaType', () => { | |||||
| // This happens when `mockApi: ComponentApi`, but doesn't when | ||||||
| // `mockApi {} satisfies ComponentApi`! | ||||||
| const inferredIsAny: IsAny<InferredType> = false; | ||||||
| assert.strictEqual(inferredIsAny, false); | ||||||
|
|
||||||
| // When types are not "any", check that they're the same by checking if they | ||||||
| // extend each other. | ||||||
|
|
@@ -132,5 +133,6 @@ describe('InferredComponentApiSchemaType', () => { | |||||
| // typesMatchExact only accepts "true" if `TypesAreEquivalent` | ||||||
| const typesMatchExact: TypesAreEquivalent<ExpectedType, InferredType> = | ||||||
| true; | ||||||
| assert.strictEqual(typesMatchExact, true); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the other type-level check, using To make the intent clearer and avoid a redundant runtime check, you can use the
Suggested change
|
||||||
| }); | ||||||
| }); | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While using
assert.strictEqualworks to silence the 'no-unused-vars' lint error, it adds a runtime assertion for what is a compile-time type check. The purpose ofinferredIsAnyis to fail at compile time if the type is incorrect, not to be asserted at runtime.A more idiomatic and clearer way to mark a variable as intentionally used for its type-level effects is to use the
voidoperator. This signals that you are using the variable for its compile-time check and intentionally discarding its value, without adding a runtime assertion.