File tree Expand file tree Collapse file tree 4 files changed +24
-8
lines changed
convex/src/cli/codegen_templates Expand file tree Collapse file tree 4 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ import type {
28
28
declare const fullApi : ApiFromModules < {
29
29
messages : typeof messages ;
30
30
} > ;
31
- declare const fullApiWithMounts : typeof fullApi & {
31
+ export type Mounts = {
32
32
messages : {
33
33
dateNow : FunctionReference < "query" , "public" , { } , any > ;
34
34
hello : FunctionReference < "action" , "public" , { } , any > ;
@@ -43,6 +43,10 @@ declare const fullApiWithMounts: typeof fullApi & {
43
43
tryToPaginate : FunctionReference < "query" , "public" , { } , any > ;
44
44
} ;
45
45
} ;
46
+ // For now fullApiWithMounts is only fullApi which provides
47
+ // jump-to-definition in component client code.
48
+ // Use Mounts for the same type without the inference.
49
+ declare const fullApiWithMounts : typeof fullApi ;
46
50
47
51
export declare const api : FilterApi <
48
52
typeof fullApiWithMounts ,
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ import type {
28
28
declare const fullApi : ApiFromModules < {
29
29
messages : typeof messages ;
30
30
} > ;
31
- declare const fullApiWithMounts : typeof fullApi & {
31
+ export type Mounts = {
32
32
messages : {
33
33
envVarAction : FunctionReference < "action" , "public" , any , any > ;
34
34
envVarQuery : FunctionReference < "query" , "public" , any , any > ;
@@ -37,6 +37,10 @@ declare const fullApiWithMounts: typeof fullApi & {
37
37
systemEnvVarQuery : FunctionReference < "query" , "public" , any , any > ;
38
38
} ;
39
39
} ;
40
+ // For now fullApiWithMounts is only fullApi which provides
41
+ // jump-to-definition in component client code.
42
+ // Use Mounts for the same type without the inference.
43
+ declare const fullApiWithMounts : typeof fullApi ;
40
44
41
45
export declare const api : FilterApi <
42
46
typeof fullApiWithMounts ,
Original file line number Diff line number Diff line change @@ -28,12 +28,16 @@ import type {
28
28
declare const fullApi : ApiFromModules < {
29
29
throwSystemError : typeof throwSystemError ;
30
30
} > ;
31
- declare const fullApiWithMounts : typeof fullApi & {
31
+ export type Mounts = {
32
32
throwSystemError : {
33
33
fromAction : FunctionReference < "action" , "public" , any , any > ;
34
34
fromQuery : FunctionReference < "query" , "public" , any , any > ;
35
35
} ;
36
36
} ;
37
+ // For now fullApiWithMounts is only fullApi which provides
38
+ // jump-to-definition in component client code.
39
+ // Use Mounts for the same type without the inference.
40
+ declare const fullApiWithMounts : typeof fullApi ;
37
41
38
42
export declare const api : FilterApi <
39
43
typeof fullApiWithMounts ,
Original file line number Diff line number Diff line change @@ -123,13 +123,17 @@ async function* codegenApiWithMounts(
123
123
definitionPath : ComponentDefinitionPath ,
124
124
) : AsyncGenerator < string > {
125
125
const mountTree = await buildMountTree ( ctx , startPush , definitionPath , [ ] ) ;
126
- if ( ! mountTree ) {
126
+ if ( mountTree ) {
127
+ yield "export type Mounts = " ;
128
+ yield * codegenMountTree ( mountTree ) ;
129
+ yield `;` ;
130
+ yield `// For now fullApiWithMounts is only fullApi which provides` ;
131
+ yield `// jump-to-definition in component client code.` ;
132
+ yield `// Use Mounts for the same type without the inference.` ;
133
+ yield "declare const fullApiWithMounts: typeof fullApi;" ;
134
+ } else {
127
135
yield "declare const fullApiWithMounts: typeof fullApi;" ;
128
- return ;
129
136
}
130
- yield "declare const fullApiWithMounts: typeof fullApi &" ;
131
- yield * codegenMountTree ( mountTree ) ;
132
- yield `;` ;
133
137
}
134
138
135
139
function * codegenMountTree ( tree : MountTree ) : Generator < string > {
You can’t perform that action at this time.
0 commit comments