NullVoxPopuli / ember-resources

An implementation of Resources. Supports ember 3.28+
https://github.com/NullVoxPopuli/ember-resources/blob/main/docs/docs/README.md
MIT License
91 stars 37 forks source link

chore(deps): update dependency expect-type to ^0.17.0 - autoclosed #1014

Closed renovate[bot] closed 8 months ago

renovate[bot] commented 10 months ago

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
expect-type ^0.16.0 -> ^0.17.0 age adoption passing confidence

Release Notes

mmkal/expect-type (expect-type) ### [`v0.17.3`](https://togithub.com/mmkal/expect-type/releases/tag/v0.17.3) [Compare Source](https://togithub.com/mmkal/expect-type/compare/v0.17.2...v0.17.3) - docs: why-is-my-assertion-failing [`907b8aa`](https://togithub.com/mmkal/expect-type/commit/907b8aa) - I think the previous build was out of date somehow too, so see https://github.com/mmkal/expect-type/releases/v0.17.2 ### [`v0.17.2`](https://togithub.com/mmkal/expect-type/releases/tag/v0.17.2) [Compare Source](https://togithub.com/mmkal/expect-type/compare/v0.17.1...v0.17.2) - Improve tuple errors ([#​40](https://togithub.com/mmkal/expect-type/issues/40)) [`4b38117`](https://togithub.com/mmkal/expect-type/commit/4b38117) Diff(truncated - scroll right!): ```diff 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) | (() => IterableIterator); [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`](https://togithub.com/mmkal/expect-type/releases/tag/v0.17.1) [Compare Source](https://togithub.com/mmkal/expect-type/compare/v0.17.0...v0.17.1) - disallow `.not` and `.branded` together [`cf38918`](https://togithub.com/mmkal/expect-type/commit/cf38918) (this was actually documented in the [v0.17.0 release](https://togithub.com/mmkal/expect-type/releases/tag/v0.17.0) but really it was only pushed here) ### [`v0.17.0`](https://togithub.com/mmkal/expect-type/releases/tag/v0.17.0) [Compare Source](https://togithub.com/mmkal/expect-type/compare/v0.16.0...v0.17.0) [#​16](https://togithub.com/mmkal/expect-type/issues/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](https://togithub.com/mmkal/expect-type#error-messages) 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().toEqualTypeOf()`). 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: ```ts 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](https://togithub.com/mmkal/expect-type) 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' 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 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](https://togithub.com/microsoft/TypeScript/pull/40468) 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: ```ts expectTypeOf({a: 1}).toEqualTypeOf({a: ''}) ``` Will be less helpful than for an assertion like this: ```ts 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`: ```ts const one = valueFromFunctionOne({some: {complex: inputs}}) const two = valueFromFunctionTwo({some: {other: inputs}}) expectTypeOf(one).toEqualTypeof() ``` *** Kinda-breaking changes: essentially none, but technically, `.branded` no longer returns a "full" `ExpectTypeOf` instance at compile-time. Previously you could do this: ```ts 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 `// @​ts-expect-error` instead of `not` if you have a negated case where you need `branded`: ```ts // @​ts-expect-error expectTypeOf<{a: {b: 1} & {c: 1}}>().branded.not.toEqualTypeOf<{a: {b: 1; c: ''}}>() ``` *** #### What's Changed - Improve CLI error messages by [@​mmkal](https://togithub.com/mmkal) in [https://github.com/mmkal/expect-type/pull/16](https://togithub.com/mmkal/expect-type/pull/16) - expect-type is usually a dev dependency by [@​SerkanSipahi](https://togithub.com/SerkanSipahi) in [https://github.com/mmkal/expect-type/pull/39](https://togithub.com/mmkal/expect-type/pull/39) #### New Contributors - [@​SerkanSipahi](https://togithub.com/SerkanSipahi) made their first contribution in [https://github.com/mmkal/expect-type/pull/39](https://togithub.com/mmkal/expect-type/pull/39) **Full Changelog**: https://github.com/mmkal/expect-type/compare/v0.16.0...v0.17.0

Configuration

📅 Schedule: Branch creation - "after 9pm on sunday" (UTC), Automerge - At any time (no schedule defined).

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



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

stackblitz[bot] commented 10 months ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

changeset-bot[bot] commented 10 months ago

⚠️ No Changeset found

Latest commit: 87b4b2ef5c710e87fa97d4bb4f4472862dc2d0b5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

github-actions[bot] commented 10 months ago

Estimated impact to a consuming app, depending on which bundle is imported

js min min + gzip min + brotli
/index.js 26.22 kB 5.71 kB 2.1 kB 1.85 kB
├── core/class-based/index.js 9.39 kB 2.48 kB 1.16 kB 999 B
├── core/function-based/index.js 15.01 kB 4.12 kB 1.55 kB 1.35 kB
└── core/use.js 11.18 kB 3.46 kB 1.4 kB 1.22 kB
/link.js 2.67 kB 376 B 233 B 185 B
/service.js 20.59 kB 5.74 kB 2.12 kB 1.86 kB
/util/debounce.js 3.07 kB 861 B 445 B 373 B
/util/ember-concurrency.js 5.07 kB 1.59 kB 750 B 640 B
/util/fps.js 3.16 kB 919 B 480 B 386 B
/util/function.js 10.06 kB 2.77 kB 1.02 kB 911 B
/util/helper.js 2.12 kB 303 B 218 B 177 B
/util/keep-latest.js 2.08 kB 412 B 261 B 209 B
/util/map.js 5.95 kB 2.44 kB 1.1 kB 924 B
/util/remote-data.js 7.96 kB 2.37 kB 808 B 705 B
github-actions[bot] commented 10 months ago

Preview URLs

readme: https://39b61782.ember-resources.pages.dev api docs: https://39b61782.ember-resources.pages.dev/modules.html