Skip to content

Commit 9c873d7

Browse files
committed
more types
1 parent dce5d04 commit 9c873d7

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

packages/cubejs-schema-compiler/src/compiler/DataSchemaCompiler.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ type CompileCubeFilesCompilers = {
8989
contextCompilers?: CompilerInterface[];
9090
};
9191

92+
export type CompileContext = any;
93+
9294
export class DataSchemaCompiler {
9395
private readonly repository: SchemaFileRepository;
9496

@@ -124,7 +126,7 @@ export class DataSchemaCompiler {
124126

125127
private readonly compilerCache: CompilerCache;
126128

127-
private readonly compileContext: any;
129+
private readonly compileContext: CompileContext;
128130

129131
private errorReportOptions: ErrorReporterOptions | undefined;
130132

@@ -179,7 +181,7 @@ export class DataSchemaCompiler {
179181
this.compiledScriptCache = options.compiledScriptCache;
180182
}
181183

182-
public compileObjects(compileServices, objects, errorsReport: ErrorReporter) {
184+
public compileObjects(compileServices: CompilerInterface[], objects, errorsReport: ErrorReporter) {
183185
try {
184186
return compileServices
185187
.map((compileService) => (() => compileService.compile(objects, errorsReport)))
@@ -193,7 +195,7 @@ export class DataSchemaCompiler {
193195
}
194196
}
195197

196-
protected async loadPythonContext(files, nsFileName) {
198+
protected async loadPythonContext(files: FileContent[], nsFileName: string): Promise<PythonCtx> {
197199
const ns = files.find((f) => f.fileName === nsFileName);
198200
if (ns) {
199201
return this.nativeInstance.loadPythonContext(

packages/cubejs-schema-compiler/src/compiler/YamlCompiler.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { nonStringFields } from './CubeValidator';
1515
import { CubeDictionary } from './CubeDictionary';
1616
import { ErrorReporter } from './ErrorReporter';
1717
import { camelizeCube } from './utils';
18+
import { CompileContext } from './DataSchemaCompiler';
1819

1920
type EscapeStateStack = {
2021
inFormattedStr?: boolean;
@@ -50,7 +51,7 @@ export class YamlCompiler {
5051
});
5152
}
5253

53-
public async renderTemplate(file: FileContent, compileContext, pythonContext: PythonCtx): Promise<FileContent> {
54+
public async renderTemplate(file: FileContent, compileContext: CompileContext, pythonContext: PythonCtx): Promise<FileContent> {
5455
return {
5556
fileName: file.fileName,
5657
content: await this.getJinjaEngine().renderTemplate(file.fileName, compileContext, {
@@ -63,7 +64,7 @@ export class YamlCompiler {
6364
public async compileYamlWithJinjaFile(
6465
file: FileContent,
6566
errorsReport: ErrorReporter,
66-
compileContext,
67+
compileContext: CompileContext,
6768
pythonContext: PythonCtx
6869
): Promise<FileContent | undefined> {
6970
const renderedFile = await this.renderTemplate(file, compileContext, pythonContext);

0 commit comments

Comments
 (0)