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.20.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

This PR contains the following updates:

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

Release Notes

mmkal/expect-type (expect-type)

v0.20.0

Compare Source

Breaking changes

This change updates how overloaded functions are treated. Now, .parameters gives you a union of the parameter-tuples that a function can take. For example, given the following type:

type Factorize = {
  (input: number): number[]
  (input: bigint): bigint[]
}

Behvaiour before:

expectTypeOf<Factorize>().parameters.toEqualTypeOf<[bigint]>()

Behaviour now:

expectTypeOf<Factorize>().parameters.toEqualTypeOf<[number] | [bigint]>()

There were similar changes for .returns, .parameter(...), and .toBeCallableWith. Also, overloaded functions are now differentiated properly when using .branded.toEqualTypeOf (this was a bug that it seems nobody found).

See #​83 for more details or look at the updated docs (including a new section called "Overloaded functions", which has more info on how this behaviour differs for TypeScript versions before 5.3).

What's Changed

Full Changelog: mmkal/expect-type@v0.19.0...v0.20.0

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 is behind base branch, 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 was generated by Mend Renovate. View the repository job log.

@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/expect-type@0.20.0 None 0 109 kB mmkale

🚮 Removed packages: npm/expect-type@0.15.0)

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
Copy link

coderabbitai bot commented Dec 11, 2023

Warning

Rate limit exceeded

@renovate[bot] has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 28 minutes and 40 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 4fc724c and a67d41d.

Walkthrough

The recent update in the package.json file reflects a version upgrade of the expect-type package from 0.15.0 to 0.20.0. This change aims to enhance type-checking capabilities in TypeScript, potentially adding new features and improvements. While the specifics of these enhancements are not detailed, the update is expected to contribute positively to type safety and the overall developer experience.

Changes

Files Change Summary
package.json Updated expect-type version from 0.15.0 to 0.20.0

Poem

In the garden of code, I hop with delight,
A new version blooms, oh what a sight! 🌼
With expect-type shining, so bright and true,
Type safety's a treasure, for me and for you!
Hopping through changes, with joy in my heart,
Let's celebrate progress, it's a wonderful start! 🐰✨


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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

CodeRabbit Configuration 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
@renovate renovate bot force-pushed the renovate/expect-type-0.x branch from e0148dc to 4fc724c Compare August 20, 2024 18:42
@renovate renovate bot changed the title chore(deps): update devdependency expect-type to v0.19.0 chore(deps): update devdependency expect-type to v0.20.0 Aug 20, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 29e0786 and 4fc724c.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (1)
  • package.json (1 hunks)
Additional comments not posted (1)
package.json (1)

58-58: Verify compatibility of expect-type version update.

The expect-type package has been updated from 0.15.0 to 0.20.0. Ensure that this update is compatible with your codebase and does not introduce any breaking changes.

Run the following script to check for any breaking changes or compatibility issues:

@renovate renovate bot force-pushed the renovate/expect-type-0.x branch from 4fc724c to a67d41d Compare August 22, 2024 20:42
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.

0 participants