-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use the Extensions
Row type machinery when using a type with a custom parser.
#2080
Comments
@thruflo I explained usage of We use If we look at your snippet: export function matchStream<T extends Row> The problem is that export function matchStream<T extends Row<never>> Thus, we require To fix this problem, you need to modify your definition of export function matchStream<T extends Row<unknown>> Now, we're saying that |
Brilliant, thanks for the lesson :) Out of interest, I see GetExtensions used in the type signatures of a few of the react-hooks functions, like getShapeStream. Is there any scenario where I might use it directly? |
You can use it whenever you need the type of the extensions but you only have the entire |
I have a type like this:
The
created_at
field is aDate
column, stored as atimestamptz
field in Postgres. This is not one of the types supported by the default parser, so I use a custom parser with myShapeStreamOptions
:I later call
stream.subscribe
with a callback function and get a type error. Just to give the full context, I callstream.subscribe
as part of thismatchStream
function:E.g. by calling:
This raises a type error:
Now, I see there's some clever type machinery in the
Row
type definition in the Typescript client insrc/types.ts
designed to support types using a custom parser:How do I use this when defining my
Todo
type to provide the information about the created_at field'sDate
type?The text was updated successfully, but these errors were encountered: