Hello. I have a field with `Json` but when I try t...
# orm-help
b
Hello. I have a field with
Json
but when I try to write data to it I get the following error:
Type 'OrderOutput[]' is not assignable to type 'InputJsonValue'.
I thought Json should be able to take any valid json. Pasting the interface in the thread ๐Ÿ‘‰
Copy code
export interface OrderOutput {
	[key: string]: JSONValue;
	id: string;
	noLines: number;
	type: number;
	lines: {
		no: string;
		variantCode: string;
		description: string;
		qty: number;
		engraving?: string;
	}[];
}
r
@benjick ๐Ÿ‘‹ Currently defining the type of content in a Json field isnโ€™t possible so you would need to cast it to
any
when passing it to Prisma.
b
@Ryan okay thanks, that's what I did to get around. Cheers!
๐Ÿ’ฏ 1
f
๐Ÿ‘‹๐Ÿผ @Ryan thanks for the tip! Is there any chance to get this on the roadmap? I'm currently migrating from typeorm where there is no special effort to map typed object to json. By the way, despite some small drawbacks when coming from typeorm (enum handling, missing @exclude, json typings), prisma is REALLY nice (doc, API, migration, etc.), well worth it! โค๏ธ
๐Ÿ™Œ 1
Ok, I've just found the dedicated issue : https://github.com/prisma/prisma/issues/3219
๐Ÿ’ฏ 1
r
Yes thatโ€™s the issue and you can add any comments there too ๐Ÿ™‚
๐Ÿ‘๐Ÿผ 1