Update dependency @rtk-query/codegen-openapi to v1.2.0 #20

Merged
romanjaros merged 1 commit from renovate/rtk-query-codegen-openapi-1.x into master 2023-11-16 23:56:13 +01:00
Member

This PR contains the following updates:

Package Type Update Change
@rtk-query/codegen-openapi (source) devDependencies minor 1.0.0 -> 1.2.0

Release Notes

reduxjs/redux-toolkit (@​rtk-query/codegen-openapi)

v1.2.0

Compare Source

This release rewrites the createAction and createSlice types to enable better user readability and reusability, and fixes an issue with the bundling and publishing of the immutable state invariant middleware.

(Note: this release was broken due to a missing TS type definition file. Please use v1.2.1 instead.)

Changes

Type Inference Readability Improvements

The type definitions for createAction and createSlice were primarily written using the TS type keyword. The TS compiler and inference engine tries to "unwrap" those types, which meant that the inferred type for a variable like const test = createAction<number, 'test'>('test') would be shown in an IDE tooltip like this:

WithTypeProperty<WithMatch<(<PT extends number>(payload: PT) => WithPayload<PT, Action<"test">>), "test", number, never, never>, "test">

That unwrapped type declaration is hard to read, and not very informative for app developers.

We've rewritten most of our types to use the interface keyword instead. Now, that same variable's inferred type would be displayed as:

ActionCreatorWithPayload<number, "test">

This is more informative and easier to read.

Type Export Improvements

Several users had noted that the complexity of the type definitions for createSlice made it impossible to write a higher-order or wrapper function in TypeScript that called createSlice internally ( #​276, #​286). As part of the typings update, we've refactored the type declarations to expose some public types that can be used to correctly define the arguments that will be passed to createSlice, and documented how to wrap createSlice in the "Usage with TypeScript" docs page. We've also documented all of the types in the codebase.

Thanks to @​phryneas for all the hard work on these type improvements!

Module Bundling Fixes

The build tooling setup for RTK tries to deal with several different use cases (dev vs prod, CJS vs ESM vs UMD modules, etc). There were problems with the build config that resulted in a require() statement being included in the ESM build, and the UMD dev build was actually missing the immutable invariant middleware. The build tooling has been updated to fix those issues.

Changelog

v1.1.3

Compare Source

v1.1.2

Compare Source

v1.1.1

Compare Source

v1.1.0

Compare Source

This release adds a utility function for better type safety with reducer object parameters, and fixes an issue with error message in the serializability check middleware.

Changes

Type-Safe Reducer Object Builder API

createReducer accepts a plain object full of reducer functions as a parameter, where the keys are the action types that should be handled. While this works fine with plain JS, TypeScript is unable to infer the correct type for the action parameters in each reducer.

As an alternative, you may now pass a callback function to createReducer that will be given a "builder" object that allows you to add reducers in a type-safe way based on the provided action types:

const increment = createAction<number, 'increment'>('increment')
const decrement = createAction<number, 'decrement'>('decrement')
createReducer(0, builder =>
  builder
    .addCase(increment, (state, action) => {
      // action is inferred correctly here
    })
    .addCase(decrement, (state, action: PayloadAction<string>) => {
      // this would error out
    })
)

While this API is usable from plain JS, it has no real benefit there, and is primarily intended for use with TS.

The same API is also available for the extraReducers argument of createSlice. It is not necessary for the reducers argument, as the action types are already being defined there.

Serialization Error Fixes

Error messages for the serialization check middleware were not correctly displaying the value. This has been fixed.

Docs Updates

Docusaurus v2

Our documentation site at https://redux-toolkit.js.org has been upgraded to use Docusaurus v2! This comes with a shiny new look and feel, and page loads are now even more Blazing Fast (TM).

Thanks to @​endiliey, @​yangshunz, @​wgao19, and @​ashakkk for all their hard work on the migration!

New "Usage with TypeScript" Page

We now have a new "Usage with TypeScript" docs page that has examples on how to correctly write and type usage of RTK.

Changelog

Code
Docs

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

This PR has been generated by Renovate Bot.

This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@rtk-query/codegen-openapi](https://redux-toolkit.js.org) ([source](https://github.com/reduxjs/redux-toolkit)) | devDependencies | minor | [`1.0.0` -> `1.2.0`](https://renovatebot.com/diffs/npm/@rtk-query%2fcodegen-openapi/1.0.0/1.2.0) | --- ### Release Notes <details> <summary>reduxjs/redux-toolkit (@&#8203;rtk-query/codegen-openapi)</summary> ### [`v1.2.0`](https://github.com/reduxjs/redux-toolkit/releases/tag/v1.2.0) [Compare Source](https://github.com/reduxjs/redux-toolkit/compare/e657098ad8e8d13e3757b5c2cfe17c594320f6b9...v1.2.0) This release rewrites the `createAction` and `createSlice` types to enable better user readability and reusability, and fixes an issue with the bundling and publishing of the immutable state invariant middleware. (**Note**: this release was broken due to a missing TS type definition file. Please use [v1.2.1](https://github.com/reduxjs/redux-toolkit/releases/tag/v1.2.1) instead.) #### Changes ##### Type Inference Readability Improvements The type definitions for `createAction` and `createSlice` were primarily written using the TS `type` keyword. The TS compiler and inference engine tries to "unwrap" those types, which meant that the inferred type for a variable like `const test = createAction<number, 'test'>('test')` would be shown in an IDE tooltip like this: ```ts WithTypeProperty<WithMatch<(<PT extends number>(payload: PT) => WithPayload<PT, Action<"test">>), "test", number, never, never>, "test"> ``` That unwrapped type declaration is hard to read, and not very informative for app developers. We've rewritten most of our types to use the `interface` keyword instead. Now, that same variable's inferred type would be displayed as: ```ts ActionCreatorWithPayload<number, "test"> ``` This is more informative and easier to read. ##### Type Export Improvements Several users had noted that the complexity of the type definitions for `createSlice` made it impossible to write a higher-order or wrapper function in TypeScript that called `createSlice` internally ( [#&#8203;276](https://github.com/reduxjs/redux-toolkit/issues/276), [#&#8203;286](https://github.com/reduxjs/redux-toolkit/issues/286)). As part of the typings update, we've refactored the type declarations to expose some public types that can be used to correctly define the arguments that will be passed to `createSlice`, and [documented how to wrap `createSlice` in the "Usage with TypeScript" docs page](https://redux-toolkit.js.org/usage/usage-with-typescript#wrapping-createslice). We've also documented all of the types in the codebase. Thanks to [@&#8203;phryneas](https://github.com/phryneas) for all the hard work on these type improvements! ##### Module Bundling Fixes The build tooling setup for RTK tries to deal with several different use cases (dev vs prod, CJS vs ESM vs UMD modules, etc). There were problems with the build config that resulted in a `require()` statement being included in the ESM build, and the UMD dev build was actually missing the immutable invariant middleware. The build tooling has been updated to fix those issues. #### Changelog - exportable case reducers type, bugfix, documentation ([@&#8203;phryneas](https://github.com/phryneas) - [#&#8203;290](https://github.com/reduxjs/redux-toolkit/issues/290)) - refactor actionCreator typings from `type` to `interface` ([@&#8203;phryneas](https://github.com/phryneas) - [#&#8203;273](https://github.com/reduxjs/redux-toolkit/issues/273)) - Mock the console manually ([@&#8203;kevin940726](https://github.com/kevin940726) - [#&#8203;281](https://github.com/reduxjs/redux-toolkit/issues/281)) - Use console-testing-library to get consistent snapshots ([@&#8203;kevin940726](https://github.com/kevin940726) - [#&#8203;277](https://github.com/reduxjs/redux-toolkit/issues/277)) - Fix module bundling & ESM runtime error ([@&#8203;alex-ketch](https://github.com/alex-ketch) - [#&#8203;280](https://github.com/reduxjs/redux-toolkit/issues/280)) ### [`v1.1.3`](https://github.com/reduxjs/redux-toolkit/compare/f40687c00d62d5a5ad10af5231f72cc645e0afb9...e657098ad8e8d13e3757b5c2cfe17c594320f6b9) [Compare Source](https://github.com/reduxjs/redux-toolkit/compare/f40687c00d62d5a5ad10af5231f72cc645e0afb9...e657098ad8e8d13e3757b5c2cfe17c594320f6b9) ### [`v1.1.2`](https://github.com/reduxjs/redux-toolkit/compare/63f9ef5fe619681d188698b34ee8736c58041776...f40687c00d62d5a5ad10af5231f72cc645e0afb9) [Compare Source](https://github.com/reduxjs/redux-toolkit/compare/63f9ef5fe619681d188698b34ee8736c58041776...f40687c00d62d5a5ad10af5231f72cc645e0afb9) ### [`v1.1.1`](https://github.com/reduxjs/redux-toolkit/compare/v1.1.0...63f9ef5fe619681d188698b34ee8736c58041776) [Compare Source](https://github.com/reduxjs/redux-toolkit/compare/v1.1.0...63f9ef5fe619681d188698b34ee8736c58041776) ### [`v1.1.0`](https://github.com/reduxjs/redux-toolkit/releases/tag/v1.1.0) [Compare Source](https://github.com/reduxjs/redux-toolkit/compare/@rtk-query/codegen-openapi@1.0.0...v1.1.0) This release adds a utility function for better type safety with reducer object parameters, and fixes an issue with error message in the serializability check middleware. #### Changes ##### Type-Safe Reducer Object Builder API `createReducer` accepts a plain object full of reducer functions as a parameter, where the keys are the action types that should be handled. While this works fine with plain JS, TypeScript is unable to infer the correct type for the action parameters in each reducer. As an alternative, you may now pass a callback function to `createReducer` that will be given a "builder" object that allows you to add reducers in a type-safe way based on the provided action types: ```ts const increment = createAction<number, 'increment'>('increment') const decrement = createAction<number, 'decrement'>('decrement') createReducer(0, builder => builder .addCase(increment, (state, action) => { // action is inferred correctly here }) .addCase(decrement, (state, action: PayloadAction<string>) => { // this would error out }) ) ``` While this API is usable from plain JS, it has no real benefit there, and is primarily intended for use with TS. The same API is also available for the `extraReducers` argument of `createSlice`. It is not necessary for the `reducers` argument, as the action types are already being defined there. ##### Serialization Error Fixes Error messages for the serialization check middleware were not correctly displaying the value. This has been fixed. #### Docs Updates ##### Docusaurus v2 Our documentation site at https://redux-toolkit.js.org has been upgraded to use Docusaurus v2! This comes with a shiny new look and feel, and page loads are now even more Blazing Fast (TM). Thanks to [@&#8203;endiliey](https://github.com/endiliey), [@&#8203;yangshunz](https://github.com/yangshunz), [@&#8203;wgao19](https://github.com/wgao19), and [@&#8203;ashakkk](https://github.com/ashakkk) for all their hard work on the migration! ##### New "Usage with TypeScript" Page We now have a new ["Usage with TypeScript"](https://redux-toolkit.js.org/usage-guide/usage-with-typescript) docs page that has examples on how to correctly write and type usage of RTK. #### Changelog ##### Code - alternative callback-builder-style notation for actionsMap ([@&#8203;phryneas](https://github.com/phryneas) - [#&#8203;262](https://github.com/reduxjs/redux-toolkit/issues/262)) - Inline values in error messages ([@&#8203;kevin940726](https://github.com/kevin940726) - [#&#8203;257](https://github.com/reduxjs/redux-toolkit/issues/257)) ##### Docs - WiP: Integrate docusaurus 2 ([@&#8203;ashakkk](https://github.com/ashakkk), [@&#8203;wgao19](https://github.com/wgao19), [@&#8203;endiliey](https://github.com/endiliey), [@&#8203;yangshungz](https://github.com/yangshungz) - [#&#8203;247](https://github.com/reduxjs/redux-toolkit/issues/247)) - document alternative callback-builder-style notation for actions… ([#&#8203;268](https://github.com/reduxjs/redux-toolkit/issues/268)) - fix build link and improve download badge labels ([@&#8203;aholachek](https://github.com/aholachek) - [#&#8203;263](https://github.com/reduxjs/redux-toolkit/issues/263)) - Add "Usage with TypeScript" section to the docs ([@&#8203;phryneas](https://github.com/phryneas) - [#&#8203;267](https://github.com/reduxjs/redux-toolkit/issues/267)) </details> --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy42MC4yIiwidXBkYXRlZEluVmVyIjoiMzcuNjAuMiIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9-->
mr.renovate added 1 commit 2023-11-16 18:34:56 +01:00
Update dependency @rtk-query/codegen-openapi to v1.2.0
All checks were successful
forgejo/Procyon/seedling/pipeline/head This commit looks good
forgejo/Procyon/seedling/pipeline/pr-master This commit looks good
ea0c7ae759
requested review from romanjaros 2023-11-16 18:34:56 +01:00
romanjaros merged commit 8a8898509b into master 2023-11-16 23:56:13 +01:00
romanjaros deleted branch renovate/rtk-query-codegen-openapi-1.x 2023-11-16 23:56:13 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: procyon/seedling#20
No description provided.