File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export type FragmentBuilder = {
4949 * This is intended to take a tagged template tag function.
5050 */
5151 toTaggedTemplate : < T > (
52- tag : ( strings : string [ ] , ...bindings : string [ ] ) => T ,
52+ tag : ( strings : TemplateStringsArray , ...bindings : string [ ] ) => T ,
5353 ) => T ;
5454 toRaw : ( ) => RawFragment ;
5555} ;
@@ -114,11 +114,14 @@ export class QueryBuilder {
114114 } ;
115115 } ,
116116 toTaggedTemplate : < T > (
117- tag : ( strings : string [ ] , ..._bindings : string [ ] ) => T ,
117+ tag : ( strings : TemplateStringsArray , ..._bindings : string [ ] ) => T ,
118118 ) => {
119119 onUsage ( ) ;
120120
121- return tag ( buildStrings ( ) , ...bindings ) ;
121+ const raw = buildStrings ( ) ;
122+ const strings = [ ...raw ] as string [ ] & { raw : string [ ] } ;
123+ strings . raw = raw ;
124+ return tag ( strings , ...bindings ) ;
122125 } ,
123126 withArrayBindings : ( { placeholder : userPlaceholder = '?' } = { } ) => {
124127 if ( typeof userPlaceholder !== 'function' ) {
Original file line number Diff line number Diff line change @@ -112,10 +112,14 @@ describe('SqlCursorPagination', () => {
112112 } ) ,
113113 ) . toMatchSnapshot ( ) ;
114114 expect (
115- builder . toTaggedTemplate ( ( strings , ...bindings ) => ( {
116- bindings,
117- strings,
118- } ) ) ,
115+ builder . toTaggedTemplate ( ( strings , ...bindings ) => {
116+ expect ( Array . isArray ( strings ) ) . toBe ( true ) ;
117+ expect ( strings . raw ) . toStrictEqual ( [ ...strings ] ) ;
118+ return {
119+ bindings,
120+ strings,
121+ } ;
122+ } ) ,
119123 ) . toMatchSnapshot ( ) ;
120124 } ;
121125
You can’t perform that action at this time.
0 commit comments