File tree Expand file tree Collapse file tree
src/codegen/code-generators Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,8 +32,8 @@ export class NodeTypeScriptGenerator extends BaseTypescriptGenerator {
3232 export class PrefabTypesafeNode {
3333 constructor(private prefab: Prefab) { }
3434
35- get<K extends keyof PrefabTypeGeneration.NodeServerConfigurationRaw>(key: K, contexts?: Contexts | ContextObj): PrefabTypeGeneration.NodeServerConfigurationRaw[K] {
36- return this.prefab.get(key, contexts) as PrefabTypeGeneration.NodeServerConfigurationRaw[K]
35+ async get<K extends keyof PrefabTypeGeneration.NodeServerConfigurationRaw>(key: K, contexts?: Contexts | ContextObj): Promise< PrefabTypeGeneration.NodeServerConfigurationRaw[K]> {
36+ return this.prefab.get(key, contexts) as Promise< PrefabTypeGeneration.NodeServerConfigurationRaw[K]>
3737 }
3838
3939 ${ this . generateAccessorMethods ( ) . join ( '\n\n ' ) || '// No methods generated' }
@@ -74,15 +74,15 @@ export class NodeTypeScriptGenerator extends BaseTypescriptGenerator {
7474 const returnValue = new ZodToTypescriptReturnValueMapper ( ) . resolveType ( config . schema )
7575
7676 return stripIndent `
77- ${ methodName } (contexts?: Contexts | ContextObj): PrefabTypeGeneration.NodeServerConfigurationAccessor['${ config . key } '] {
78- const raw = this.get('${ config . key } ', contexts)
77+ async ${ methodName } (contexts?: Contexts | ContextObj): Promise< PrefabTypeGeneration.NodeServerConfigurationAccessor['${ config . key } ']> {
78+ const raw = await this.get('${ config . key } ', contexts)
7979 return ${ returnValue }
8080 }
8181 `
8282 }
8383
8484 return stripIndent `
85- ${ methodName } (contexts?: Contexts | ContextObj): PrefabTypeGeneration.NodeServerConfigurationAccessor['${ config . key } '] {
85+ async ${ methodName } (contexts?: Contexts | ContextObj): Promise< PrefabTypeGeneration.NodeServerConfigurationAccessor['${ config . key } ']> {
8686 return this.get('${ config . key } ', contexts)
8787 }
8888 `
You can’t perform that action at this time.
0 commit comments