Skip to content

Commit

Permalink
pkg: Update all non-major dependencies (#3333)
Browse files Browse the repository at this point in the history
* pkg: Update all non-major dependencies

* fix: TypeScript 5.7 support

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Nathaniel Tucker <[email protected]>
  • Loading branch information
renovate[bot] and ntucker authored Dec 28, 2024
1 parent cbbb2e4 commit 1777546
Show file tree
Hide file tree
Showing 13 changed files with 164 additions and 138 deletions.
26 changes: 26 additions & 0 deletions .changeset/perfect-walls-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
'@data-client/rest': patch
---

Resource.extend() compatibility with TypeScript 5

Previously [extending existing members](https://dataclient.io/rest/api/resource#extend-override) with no
typed overrides (like [path](https://dataclient.io/rest/api/resource#path)) would not work starting with
TypeScript 5.7.

```ts
const UserResource = UserResourceBase.extend({
partialUpdate: {
getOptimisticResponse(snap, params, body) {
params.id;
params.group;
// @ts-expect-error
params.nothere;
return {
id: params.id,
...body,
};
},
},
});
```
2 changes: 1 addition & 1 deletion examples/coin-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@types/react": "*",
"@types/react-dom": "*",
"react-refresh": "*",
"typescript": "5.6",
"typescript": "5.7",
"webpack": "*",
"webpack-cli": "*"
},
Expand Down
32 changes: 16 additions & 16 deletions examples/github-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/github-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@data-client/react": "^0.14.0",
"@data-client/rest": "^0.14.0",
"@js-temporal/polyfill": "^0.4.4",
"antd": "5.22.5",
"antd": "5.22.7",
"parse-link-header": "^2.0.0",
"react": "19.0.0",
"react-dom": "19.0.0",
Expand Down
80 changes: 40 additions & 40 deletions examples/nextjs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@types/react": "19.0.2",
"@types/react-dom": "19.0.2",
"clsx": "^2.1.1",
"next": "15.1.2",
"next": "15.1.3",
"react": "19.0.0",
"react-dom": "19.0.0",
"tar-fs": "^3.0.6",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-terser": "^7.0.2",
"ts-node": "10.9.2",
"typescript": "5.6",
"typescript": "5.7",
"whatwg-fetch": "3.0.0"
},
"resolutions": {
Expand Down
10 changes: 5 additions & 5 deletions packages/rest/src/resourceExtendable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ export interface Extendable<
};
extend<
R extends ResourceInterface,
Get extends PartialRestGenerics = any,
GetList extends PartialRestGenerics = any,
Update extends PartialRestGenerics = any,
PartialUpdate extends PartialRestGenerics = any,
Delete extends PartialRestGenerics = any,
Get extends PartialRestGenerics = {},
GetList extends PartialRestGenerics = {},
Update extends PartialRestGenerics = {},
PartialUpdate extends PartialRestGenerics = {},
Delete extends PartialRestGenerics = {},
>(
this: R,
options: ResourceEndpointExtensions<
Expand Down
10 changes: 5 additions & 5 deletions packages/rest/src/resourceExtensionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ export type ExtendedResource<

export interface ResourceEndpointExtensions<
R extends ResourceInterface,
Get extends PartialRestGenerics = any,
GetList extends PartialRestGenerics = any,
Update extends PartialRestGenerics = any,
PartialUpdate extends PartialRestGenerics = any,
Delete extends PartialRestGenerics = any,
Get extends PartialRestGenerics = {},
GetList extends PartialRestGenerics = {},
Update extends PartialRestGenerics = {},
PartialUpdate extends PartialRestGenerics = {},
Delete extends PartialRestGenerics = {},
> {
readonly get?: RestEndpointOptions<
unknown extends Get ? EndpointToFunction<R['get']>
Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"react-dom": "^19.0.0",
"react-json-tree": "0.19.0",
"react-live": "^4.0.0",
"typescript": "5.6",
"typescript": "5.7",
"uuid": "^11.0.0"
},
"browserslist": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ interface CustomResource<R extends ResourceInterface, O extends ResourceGenerics
delete: unknown extends Delete ? R['delete'] : PartialRestGenerics extends Delete ? R['delete'] : RestExtendedEndpoint<Delete, R['delete']>;
}
type ExtendedResource<R extends ResourceInterface, T extends Record<string, EndpointInterface>> = Omit<R, keyof T> & T;
interface ResourceEndpointExtensions<R extends ResourceInterface, Get extends PartialRestGenerics = any, GetList extends PartialRestGenerics = any, Update extends PartialRestGenerics = any, PartialUpdate extends PartialRestGenerics = any, Delete extends PartialRestGenerics = any> {
interface ResourceEndpointExtensions<R extends ResourceInterface, Get extends PartialRestGenerics = {}, GetList extends PartialRestGenerics = {}, Update extends PartialRestGenerics = {}, PartialUpdate extends PartialRestGenerics = {}, Delete extends PartialRestGenerics = {}> {
readonly get?: RestEndpointOptions<unknown extends Get ? EndpointToFunction<R['get']> : OptionsToFunction<Get, R['get'], EndpointToFunction<R['get']>>, R['get']['schema']> & Readonly<Get>;
readonly getList?: RestEndpointOptions<unknown extends GetList ? EndpointToFunction<R['getList']> : OptionsToFunction<GetList, R['getList'], EndpointToFunction<R['getList']>>, R['getList']['schema']> & Readonly<GetList>;
readonly update?: RestEndpointOptions<unknown extends Update ? EndpointToFunction<R['update']> : OptionsToFunction<Update, R['update'], EndpointToFunction<R['update']>>, R['update']['schema']> & Readonly<Update>;
Expand All @@ -1571,7 +1571,7 @@ interface Extendable<O extends ResourceGenerics = {
}, const ExtendKey extends string, ExtendOptions extends PartialRestGenerics | {}>(this: R, key: ExtendKey, options: Readonly<RestEndpointExtendOptions<ExtendOptions, R['get'], EndpointToFunction<R['get']>> & ExtendOptions>): R & {
[key in ExtendKey]: RestExtendedEndpoint<ExtendOptions, R['get']>;
};
extend<R extends ResourceInterface, Get extends PartialRestGenerics = any, GetList extends PartialRestGenerics = any, Update extends PartialRestGenerics = any, PartialUpdate extends PartialRestGenerics = any, Delete extends PartialRestGenerics = any>(this: R, options: ResourceEndpointExtensions<R, Get, GetList, Update, PartialUpdate, Delete>): CustomResource<R, O, Get, GetList, Update, PartialUpdate, Delete>;
extend<R extends ResourceInterface, Get extends PartialRestGenerics = {}, GetList extends PartialRestGenerics = {}, Update extends PartialRestGenerics = {}, PartialUpdate extends PartialRestGenerics = {}, Delete extends PartialRestGenerics = {}>(this: R, options: ResourceEndpointExtensions<R, Get, GetList, Update, PartialUpdate, Delete>): CustomResource<R, O, Get, GetList, Update, PartialUpdate, Delete>;
extend<R extends ResourceInterface, T extends Record<string, EndpointInterface>>(this: R, extender: (baseResource: R) => T): ExtendedResource<R, T>;
}

Expand Down
4 changes: 2 additions & 2 deletions website/src/components/Playground/editor-types/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ interface CustomResource<R extends ResourceInterface, O extends ResourceGenerics
delete: unknown extends Delete ? R['delete'] : PartialRestGenerics extends Delete ? R['delete'] : RestExtendedEndpoint<Delete, R['delete']>;
}
type ExtendedResource<R extends ResourceInterface, T extends Record<string, EndpointInterface>> = Omit<R, keyof T> & T;
interface ResourceEndpointExtensions<R extends ResourceInterface, Get extends PartialRestGenerics = any, GetList extends PartialRestGenerics = any, Update extends PartialRestGenerics = any, PartialUpdate extends PartialRestGenerics = any, Delete extends PartialRestGenerics = any> {
interface ResourceEndpointExtensions<R extends ResourceInterface, Get extends PartialRestGenerics = {}, GetList extends PartialRestGenerics = {}, Update extends PartialRestGenerics = {}, PartialUpdate extends PartialRestGenerics = {}, Delete extends PartialRestGenerics = {}> {
readonly get?: RestEndpointOptions<unknown extends Get ? EndpointToFunction<R['get']> : OptionsToFunction<Get, R['get'], EndpointToFunction<R['get']>>, R['get']['schema']> & Readonly<Get>;
readonly getList?: RestEndpointOptions<unknown extends GetList ? EndpointToFunction<R['getList']> : OptionsToFunction<GetList, R['getList'], EndpointToFunction<R['getList']>>, R['getList']['schema']> & Readonly<GetList>;
readonly update?: RestEndpointOptions<unknown extends Update ? EndpointToFunction<R['update']> : OptionsToFunction<Update, R['update'], EndpointToFunction<R['update']>>, R['update']['schema']> & Readonly<Update>;
Expand All @@ -1575,7 +1575,7 @@ interface Extendable<O extends ResourceGenerics = {
}, const ExtendKey extends string, ExtendOptions extends PartialRestGenerics | {}>(this: R, key: ExtendKey, options: Readonly<RestEndpointExtendOptions<ExtendOptions, R['get'], EndpointToFunction<R['get']>> & ExtendOptions>): R & {
[key in ExtendKey]: RestExtendedEndpoint<ExtendOptions, R['get']>;
};
extend<R extends ResourceInterface, Get extends PartialRestGenerics = any, GetList extends PartialRestGenerics = any, Update extends PartialRestGenerics = any, PartialUpdate extends PartialRestGenerics = any, Delete extends PartialRestGenerics = any>(this: R, options: ResourceEndpointExtensions<R, Get, GetList, Update, PartialUpdate, Delete>): CustomResource<R, O, Get, GetList, Update, PartialUpdate, Delete>;
extend<R extends ResourceInterface, Get extends PartialRestGenerics = {}, GetList extends PartialRestGenerics = {}, Update extends PartialRestGenerics = {}, PartialUpdate extends PartialRestGenerics = {}, Delete extends PartialRestGenerics = {}>(this: R, options: ResourceEndpointExtensions<R, Get, GetList, Update, PartialUpdate, Delete>): CustomResource<R, O, Get, GetList, Update, PartialUpdate, Delete>;
extend<R extends ResourceInterface, T extends Record<string, EndpointInterface>>(this: R, extender: (baseResource: R) => T): ExtendedResource<R, T>;
}

Expand Down
Loading

0 comments on commit 1777546

Please sign in to comment.