Skip to content

Commit c2b2f10

Browse files
authored
fix: weaken JsonObject type to allow types from payload-types being assigned to it (#7815)
This fixes that type in the website template: https://github.com/payloadcms/payload/blob/3d86bf1974af652413e7bca0535faee1a86d7d02/templates/website/src/app/components/RichText/serialize.tsx#L24 Now, JsonObject still ensures that only objects can be passed, but it's weak enough to allow non-dynamic types like the ones we generate in payload-types. The "JSON" part of this type has no meaning anymore, as it does allow objects with functions now. However, we can still use it to signal to the user that this should be JSON-serializable. It's more clear than just using Record<string, unknown>
1 parent 95ebead commit c2b2f10

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

packages/payload/src/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export type JsonValue = JsonArray | JsonObject | unknown //Date | JsonArray | Js
9595
export interface JsonArray extends Array<JsonValue> {}
9696

9797
export interface JsonObject {
98-
[key: string]: JsonValue
98+
[key: string]: any
9999
}
100100

101101
export type WhereField = {

packages/plugin-stripe/src/routes/rest.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ export const stripeREST = async (args: {
3838
}
3939

4040
responseJSON = await stripeProxy({
41-
// @ts-expect-error
4241
stripeArgs,
43-
// @ts-expect-error
4442
stripeMethod,
4543
stripeSecretKey,
4644
})

0 commit comments

Comments
 (0)