Dimi
Dimi
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Dimi on 9/16/2023 in #questions
Performance concern on Nextjs 13 layout files
No description
2 replies
TtRPC
Created by Dimi on 5/10/2023 in #❓-help
SuperJSON is wrapping results in type with keys "json" and "meta"
How can I modify the transformer in SuperJSON library to only return the "json" property and ignore the "meta" property during serialization? The current behavior of the library wraps the results in the SuperJSONResult interface, but I want to access only the "json" property after serialization.
interface SuperJSONResult {
json: JSONValue;
meta?: {
values?: MinimisedTree<TypeAnnotation>;
referentialEqualities?: ReferentialEqualityAnnotations;
};
}
interface SuperJSONResult {
json: JSONValue;
meta?: {
values?: MinimisedTree<TypeAnnotation>;
referentialEqualities?: ReferentialEqualityAnnotations;
};
}
This is my current code
const t = initTRPC.context<inferAsyncReturnType<typeof createContext>>().create({
transformer: {
serialize: SuperJSON.serialize,
deserialize: SuperJSON.deserialize,
},
});
const t = initTRPC.context<inferAsyncReturnType<typeof createContext>>().create({
transformer: {
serialize: SuperJSON.serialize,
deserialize: SuperJSON.deserialize,
},
});
3 replies