xialvjun / xialvjun/ts-sql-plugin
sql.mock is not working while using separately
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 195
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
Code:
const startDateSql = sql.mock<'2022-01-01T00:00:00.0Z'>(startDate.toISOString())
const endDateSql = sql.mock<'2023-01-01T00:00:00.0Z'>(endDate.toISOString())
const query = sql`
SELECT
${startDateSql}::timestamp with time zone AS "start",
${endDateSql}::timestamp with time zone AS "end"
...
`
ts-sql-plugin:
ERROR: cannot cast type integer to timestamp with time zone
LINE 3: 0::timestamp with time zone AS "start",
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the sql.mock helper and the sql tagged-template entry point; use the supplied TypeScript reproduction to trace how separately mocked values are rendered. Done means the reproduced query no longer emits 0 for either mock and the timestamp casts succeed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql, typescript
- Domain
- databases, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100