@@ -81,8 +81,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) {
8181 const descs = getDescriptions ( def ) ;
8282
8383 chunk += writeJsdoc ( descs ) ;
84- chunk += `interface ${ typeName } {` ;
85- chunk += `[Brand.Type]: '${ nsid } ';` ;
84+ chunk += `interface ${ typeName } extends TypedBase {` ;
8685
8786 for ( const prop of propKeys ) {
8887 const isOptional = ! required || ! required . includes ( prop ) ;
@@ -123,7 +122,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) {
123122 const descs = getDescriptions ( def ) ;
124123
125124 chunk += writeJsdoc ( descs ) ;
126- chunk += ' interface Record {' ;
125+ chunk += ` interface Record extends RecordBase {` ;
127126 chunk += `$type: '${ nsid } ';` ;
128127
129128 for ( const prop of propKeys ) {
@@ -158,11 +157,11 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) {
158157 const { value, descriptions } = resolveType ( nsid , parameters ) ;
159158
160159 chunk += writeJsdoc ( descriptions ) ;
161- chunk += `interface Params ${ value } ` ;
160+ chunk += `interface Params extends TypedBase ${ value } ` ;
162161 }
163162 }
164163 else {
165- chunk += 'interface Params {}' ;
164+ chunk += 'interface Params extends TypedBase {}' ;
166165 }
167166
168167 if ( input ) {
@@ -172,7 +171,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) {
172171 chunk += writeJsdoc ( descriptions ) ;
173172
174173 if ( input . schema ?. type === 'object' ) {
175- chunk += `interface Input ${ value } ` ;
174+ chunk += `interface Input extends TypedBase ${ value } ` ;
176175 }
177176 else {
178177 chunk += `type Input = ${ value } ;` ;
@@ -193,7 +192,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) {
193192 chunk += writeJsdoc ( descriptions ) ;
194193
195194 if ( output . schema ?. type === 'object' ) {
196- chunk += `interface Output ${ value } ` ;
195+ chunk += `interface Output extends TypedBase ${ value } ` ;
197196 }
198197 else {
199198 chunk += `type Output = ${ value } ;` ;
@@ -208,7 +207,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) {
208207 }
209208
210209 if ( errors ) {
211- chunk += 'interface Errors {' ;
210+ chunk += 'interface Errors extends TypedBase {' ;
212211
213212 for ( const error of errors ) {
214213 chunk += `${ error . name } : {};` ;
@@ -256,10 +255,10 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) {
256255 if ( def . parameters ) {
257256 const { value, descriptions } = resolveType ( nsid , def . parameters ) ;
258257 chunk += writeJsdoc ( descriptions ) ;
259- chunk += `interface Params ${ value } ` ;
258+ chunk += `interface Params extends TypedBase ${ value } ` ;
260259 }
261260 else {
262- chunk += 'interface Params {}' ;
261+ chunk += 'interface Params extends TypedBase {}' ;
263262 }
264263
265264 if ( def . message ?. schema ) {
@@ -270,7 +269,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) {
270269 }
271270
272271 if ( def . errors ) {
273- chunk += 'interface Errors {' ;
272+ chunk += 'interface Errors extends TypedBase {' ;
274273 for ( const error of def . errors ) {
275274 chunk += `${ error . name } : {};` ;
276275 }
@@ -302,7 +301,7 @@ export async function generateDefinitions(opts: GenerateDefinitionsOptions) {
302301 code += '}\n\n' ;
303302 }
304303
305- code += `export declare interface Records {${ records } }\n\n` ;
304+ code += `export declare interface Records extends RecordBase {${ records } }\n\n` ;
306305 code += `export declare interface Queries {${ queries } }\n\n` ;
307306 code += `export declare interface Procedures {${ procedures } }\n\n` ;
308307 code += `export declare interface Subscriptions {${ subscriptions } }\n\n` ;
0 commit comments