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

chore(deps): update devdependency expect-type to v0.19.0 #488

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented May 30, 2023

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
expect-type 0.15.0 -> 0.19.0 age adoption passing confidence

Release Notes

mmkal/expect-type (expect-type)

v0.19.0

Compare Source

What's Changed

Full Changelog: mmkal/expect-type@0.18.0...0.19.0

v0.18.0

Compare Source

What's Changed

New Contributors

Full Changelog: mmkal/expect-type@v0.17.3...0.18.0

v0.17.3

Compare Source

v0.17.2

Compare Source

Diff(truncated - scroll right!):

test('toEqualTypeOf with tuples', () => {
  const assertion = `expectTypeOf<[[number], [1], []]>().toEqualTypeOf<[[number], [2], []]>()`
  expect(tsErrors(assertion)).toMatchInlineSnapshot(`
-    "test/test.ts:999:999 - error TS2344: Type '[[number], [2], []]' does not satisfy the constraint '{ [x: number]: { [x: number]: number; [iterator]: (() => IterableIterator<1>) | (() => IterableIterator<number>) | (() => IterableIterator<never>); [unscopables]: (() => { copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: boolean; values: boolean; }) | (() => { copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: boolean; values: boolean; }) | (() => { copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: boolean; values: boolean; }); length: 0 | 1; toString:  ... truncated!!!!'.
-      Types of property 'sort' are incompatible.
-        Type '(compareFn?: ((a: [] | [number] | [2], b: [] | [number] | [2]) => number) | undefined) => [[number], [2], []]' is not assignable to type '\\"Expected: function, Actual: function\\"'.
+    "test/test.ts:999:999 - error TS2344: Type '[[number], [2], []]' does not satisfy the constraint '{ 0: { 0: number; }; 1: { 0: \\"Expected: literal number: 2, Actual: literal number: 1\\"; }; 2: {}; }'.
+      The types of '1[0]' are incompatible between these types.
+        Type '2' is not assignable to type '\\"Expected: literal number: 2, Actual: literal number: 1\\"'.
    999 expectTypeOf<[[number], [1], []]>().toEqualTypeOf<[[number], [2], []]>()
                                                          ~~~~~~~~~~~~~~~~~~~"
  `)
})

v0.17.1

Compare Source

  • disallow .not and .branded together cf38918

(this was actually documented in the v0.17.0 release but really it was only pushed here)

v0.17.0

Compare Source

#​16 went in to - hopefully - significantly improve the error messages produce on failing assertions. Here's an example of how vitest's failing tests were improved:

Before:

image

After:

image

Docs copied from the readme about how to interpret these error messages


Error messages

When types don't match, .toEqualTypeOf and .toMatchTypeOf use a special helper type to produce error messages that are as actionable as possible. But there's a bit of an nuance to understanding them. Since the assertions are written "fluently", the failure should be on the "expected" type, not the "actual" type (expect<Actual>().toEqualTypeOf<Expected>()). This means that type errors can be a little confusing - so this library produces a MismatchInfo type to try to make explicit what the expectation is. For example:

expectTypeOf({a: 1}).toEqualTypeOf<{a: string}>()

Is an assertion that will fail, since {a: 1} has type {a: number} and not {a: string}. The error message in this case will read something like this:

test/test.ts:999:999 - error TS2344: Type '{ a: string; }' does not satisfy the constraint '{ a: \\"Expected: string, Actual: number\\"; }'.
  Types of property 'a' are incompatible.
    Type 'string' is not assignable to type '\\"Expected: string, Actual: number\\"'.

999 expectTypeOf({a: 1}).toEqualTypeOf<{a: string}>()

Note that the type constraint reported is a human-readable messaging specifying both the "expected" and "actual" types. Rather than taking the sentence Types of property 'a' are incompatible // Type 'string' is not assignable to type "Expected: string, Actual: number" literally - just look at the property name ('a') and the message: Expected: string, Actual: number. This will tell you what's wrong, in most cases. Extremely complex types will of course be more effort to debug, and may require some experimentation. Please raise an issue if the error messages are actually misleading.

The toBe... methods (like toBeString, toBeNumber, toBeVoid etc.) fail by resolving to a non-callable type when the Actual type under test doesn't match up. For example, the failure for an assertion like expectTypeOf(1).toBeString() will look something like this:

test/test.ts:999:999 - error TS2349: This expression is not callable.
  Type 'ExpectString<number>' has no call signatures.

999 expectTypeOf(1).toBeString()
                    ~~~~~~~~~~

The This expression is not callable part isn't all that helpful - the meaningful error is the next line, Type 'ExpectString<number> has no call signatures. This essentially means you passed a number but asserted it should be a string.

If TypeScript added support for "throw" types these error messagess could be improved. Until then they will take a certain amount of squinting.

Concrete "expected" objects vs typeargs

Error messages for an assertion like this:

expectTypeOf({a: 1}).toEqualTypeOf({a: ''})

Will be less helpful than for an assertion like this:

expectTypeOf({a: 1}).toEqualTypeOf<{a: string}>()

This is because the TypeScript compiler needs to infer the typearg for the .toEqualTypeOf({a: ''}) style, and this library can only mark it as a failure by comparing it against a generic Mismatch type. So, where possible, use a typearg rather than a concrete type for .toEqualTypeOf and toMatchTypeOf. If it's much more convenient to compare two concrete types, you can use typeof:

const one = valueFromFunctionOne({some: {complex: inputs}})
const two = valueFromFunctionTwo({some: {other: inputs}})

expectTypeOf(one).toEqualTypeof<typeof two>()

Kinda-breaking changes: essentially none, but technically, .branded no longer returns a "full" ExpectTypeOf instance at compile-time. Previously you could do this:

expectTypeOf<{a: {b: 1} & {c: 1}}>().branded.not.toEqualTypeOf<{a: {b: 1; c: ''}}>()
expectTypeOf<{a: {b: 1} & {c: 1}}>().not.branded.toEqualTypeOf<{a: {b: 1; c: ''}}>()

Now that won't work (and it was always slightly nonsensical), so you'd have to use // @&#8203;ts-expect-error instead of not if you have a negated case where you need branded:

// @&#8203;ts-expect-error
expectTypeOf<{a: {b: 1} & {c: 1}}>().branded.not.toEqualTypeOf<{a: {b: 1; c: ''}}>()

What's Changed

New Contributors

Full Changelog: mmkal/expect-type@v0.16.0...v0.17.0

v0.16.0

Compare Source

What's Changed

Note that #​21 has affected behavior for intersection types, which can result in (arguably) false errors:

// @&#8203;ts-expect-error the following line doesn't compile, even though the types are arguably the same.
// See https://github.com/mmkal/expect-type/pull/21
expectTypeOf<{a: 1} & {b: 2}>().toEqualTypeOf<{a: 1; b: 2}>()

Full Changelog: mmkal/expect-type@v0.15.0...v16.0.0


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - "before 4am on Monday" (UTC).

🚦 Automerge: Enabled.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot added chore dependencies Pull requests that update a dependency file labels May 30, 2023
@socket-security
Copy link

socket-security bot commented May 30, 2023

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 6 times, most recently from ffd9108 to 1a3aaf6 Compare June 6, 2023 16:59
@socket-security
Copy link

socket-security bot commented Jun 6, 2023

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] None 0 82.8 kB mmkale

🚮 Removed packages: npm/[email protected]

View full report↗︎

@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 9 times, most recently from 8bf044f to 0ae4112 Compare June 14, 2023 16:11
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 9 times, most recently from 0c70e7e to 4843f0a Compare June 22, 2023 17:06
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 2 times, most recently from 25b0a8a to ee853c1 Compare June 27, 2023 16:17
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 2 times, most recently from cf55799 to 2f061eb Compare November 20, 2023 03:59
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 2 times, most recently from 0c66b86 to b1a4ab1 Compare December 11, 2023 00:36
Copy link

coderabbitai bot commented Dec 11, 2023

Important

Auto Review Skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 2 times, most recently from 9dbac99 to 7783771 Compare December 11, 2023 03:05
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 2 times, most recently from 9f22acf to 557205c Compare January 1, 2024 00:34
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch from 557205c to b430eb4 Compare January 1, 2024 03:25
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 2 times, most recently from 506b5c9 to 83f4dc5 Compare January 15, 2024 02:17
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 2 times, most recently from c1bd828 to 8941bc8 Compare January 29, 2024 00:41
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 3 times, most recently from 5fc6eeb to d57645f Compare February 12, 2024 03:06
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 3 times, most recently from de9f0a8 to ec71c5e Compare February 26, 2024 21:34
@renovate renovate bot changed the title chore(deps): update devdependency expect-type to v0.17.3 chore(deps): update devdependency expect-type to v0.18.0 Feb 26, 2024
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 2 times, most recently from c0e2986 to e27eb5c Compare March 11, 2024 03:37
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch from e27eb5c to 6961496 Compare March 21, 2024 22:15
@renovate renovate bot changed the title chore(deps): update devdependency expect-type to v0.18.0 chore(deps): update devdependency expect-type to v0.19.0 Mar 21, 2024
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch 2 times, most recently from aa48df6 to f4a7565 Compare April 1, 2024 01:11
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch from f4a7565 to e0148dc Compare April 8, 2024 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

0 participants