zikk
zikk
Explore posts from servers
DTDrizzle Team
Created by zikk on 4/5/2024 in #help
How to stop drizzle-kit push from truncating every time ?
As the title says, some column changes make the query have unnecessary truncates. Also, i have a pg timestamp(3) field and the push every time shows me this You're about to change created_at column type from timestamp(3) to timestamp (3) with <x> items
2 replies
DTDrizzle Team
Created by zikk on 4/4/2024 in #help
Create query inserts quotes for customType with push
Hey people. So i am using PostGIS as my database, and i created a custom type for the geogrraphy point
export const geoPoint = customType<{ data: never }>({
dataType() {
return "geography(Point, 4326)";
},
toDriver(value: Point) {
return sql`ST_MakePoint(${value.latitude}, ${value.longitude})`;
},
});
export const geoPoint = customType<{ data: never }>({
dataType() {
return "geography(Point, 4326)";
},
toDriver(value: Point) {
return sql`ST_MakePoint(${value.latitude}, ${value.longitude})`;
},
});
The issue lies when i use drizzle-kit push, it makes a create query that puts the type inside quotations marks (which breaks the db query) How do i make it so that it creates the DB creation query correctly ?
...
"coords" "geography(Point, 4326)" NOT NULL,
...
...
"coords" "geography(Point, 4326)" NOT NULL,
...
error: type "geography(Point, 4326)" does not exist
error: type "geography(Point, 4326)" does not exist
2 replies
TTCTheo's Typesafe Cult
Created by zikk on 7/1/2023 in #questions
Deep react component typing
hey ts nerds, can someone help me out with this ?
export namespace StyledButton {
declare const SSpinner: import('styled-components').StyledComponent<Spinner, any, {}, never>;
declare const SButton: import('styled-components').StyledComponent<'button', any, SButtonProps, never> & {
Arrow: import('styled-components').StyledComponent<'span', any, SButtonArrowProps, never>;
}
// declare namespace SButton {
// declare const Arrow: import('styled-components').StyledComponent<'span', any, SButtonArrowProps, never>;
// }
declare const ButtonGroup: import('styled-components').StyledComponent<'div', any, ButtonGroupProps, never>;
}
export namespace StyledButton {
declare const SSpinner: import('styled-components').StyledComponent<Spinner, any, {}, never>;
declare const SButton: import('styled-components').StyledComponent<'button', any, SButtonProps, never> & {
Arrow: import('styled-components').StyledComponent<'span', any, SButtonArrowProps, never>;
}
// declare namespace SButton {
// declare const Arrow: import('styled-components').StyledComponent<'span', any, SButtonArrowProps, never>;
// }
declare const ButtonGroup: import('styled-components').StyledComponent<'div', any, ButtonGroupProps, never>;
}
When using this typing, <StyledButton.Sbutton /> works and the editor autocompletes and reads it well, but when i try <StyledButton.SButton.Arrow /> i get not help it's not working (with both methods, the one used or the one commented the whole
export declare const SButton: import('styled-components').StyledComponent<'button', any, SButtonProps, never> & {
Arrow: import('styled-components').StyledComponent<'span', any, SButtonArrowProps, never>;
}
export declare const SButton: import('styled-components').StyledComponent<'button', any, SButtonProps, never> & {
Arrow: import('styled-components').StyledComponent<'span', any, SButtonArrowProps, never>;
}
alone isn't working as i wanted it, i've seen it done like that though (in the mantine .d.ts files on their input component) Edit: if i declare it like this it works
declare const SButton: React.FC<SButtonProps> & { Arrow: ..whatever }
declare const SButton: React.FC<SButtonProps> & { Arrow: ..whatever }
This is probably due to the fact that when i install this package in another project it doesn't get styled-components typing somehow Edit 2 : figured out the "solution", add the styling package as a peer depency so the used of the package has to install it, i don't know if better can be done though
2 replies