You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,27 @@ This package "just works" with [`pg`](https://www.npmjs.com/package/pg) and [`my
79
79
mssql.query(query.strings, ...query.values);
80
80
```
81
81
82
+
### Stricter TypeScript
83
+
84
+
The default value is `unknown` to support [every possible input](https://github.com/blakeembrey/sql-template-tag/pull/26). If you want stricter TypeScript values you can create a new `sql` template tag function.
85
+
86
+
```ts
87
+
import { Sql } from"sql-template-tag";
88
+
89
+
typeSupportedValue=
90
+
|string
91
+
|number
92
+
|SupportedValue[]
93
+
| { [key:string]:SupportedValue };
94
+
95
+
function sql(
96
+
strings:ReadonlyArray<string>,
97
+
...values:Array<SupportedValue|Sql>
98
+
) {
99
+
returnnewSql(strings, values);
100
+
}
101
+
```
102
+
82
103
## Related
83
104
84
105
Some other modules exist that do something similar:
0 commit comments