-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Does typesOverrides work? #477
Comments
Thanks for flagging this. |
I ran into the same issue, the |
Before @adelsz merged my changes I used this in my {
"devDependencies": {
"@pgtyped/cli": "https://github.com/nick-keller/pgtyped/raw/patched/packages/cli/pgtyped-cli-1.0.2.tgz",
"@pgtyped/query": "^1.0.1",
}
} I am now using: {
"devDependencies": {
"@pgtyped/cli": "^1.1.0",
"@pgtyped/query": "^1.1.0",
}
} And it still works. I run {
"transforms": [
{
"mode": "sql",
"include": "**/*.sql",
"emitTemplate": "{{dir}}/{{name}}.queries.ts"
}
],
"srcDir": "./src/",
"failOnError": true,
"db": {
...
},
"typesOverrides": {
"date": "string"
}
} |
I have added e2e tests for type override testing https://github.com/adelsz/pgtyped/pull/481/files. To have the correct types (ts pg.types.setTypeParser(pg.types.builtins.DATE, function(val) {
return val;
}) To have the correct types (ts "typesOverrides": {
"date": "string"
}, @danvk & @petetnt you can try |
Ah, I assumed that the |
Great, it works as expected for you now?
Got it, I guess we should highlight this in the docs. |
I figured out what was going on — I was overriding {
"typesOverrides": {
"date": "string",
"timestamp": "string",
"timestamptz": "string"
}
} I've also been having trouble using |
I was excited to see the new
typesOverrides
option in [email protected]. However, I'm not sure it works as advertised?I added the following to my
pgtyped.config.json
based on the config inCLI.md
:Then I removed the following from my post-processing script:
Now when I run pgtyped, I see the following sorts of diffs for all my queries:
in other words, the type override isn't working. I don't see any tests in #476 so it's hard for me to tell what the expected behavior is.
I'm definitely on the right version because
"hungarianNotation": false
worked great.Some guidance on what sorts of types you can override would be helpful, for example I'd like to change
Json
→any
andJsonArray
→any[]
.The text was updated successfully, but these errors were encountered: