Skip to content

Commit

Permalink
strict types (#320)
Browse files Browse the repository at this point in the history
* strict types

* improve
  • Loading branch information
jiqiang90 authored Jun 25, 2024
1 parent 51b832c commit 8bb9bec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions packages/common-ethereum/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
export * from './codegen';
export * from './project';

import {INetworkCommonModule} from '@subql/types-core';
import {SubqlDatasource, SubqlRuntimeDatasource, SubqlCustomDatasource} from '@subql/types-ethereum';
import {EthereumNetworkModule} from '@subql/types-ethereum';
import * as c from './codegen';
import * as p from './project';

// This provides a compiled time check to ensure that the correct exports are provided
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _ = {
...p,
} satisfies INetworkCommonModule<SubqlDatasource, SubqlRuntimeDatasource, SubqlCustomDatasource>;
...c,
} satisfies EthereumNetworkModule;
10 changes: 6 additions & 4 deletions packages/types/src/modular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@

import {INetworkCommonModule} from '@subql/types-core';
import {Data} from 'ejs';
import {SubqlRuntimeDatasource} from './project';
import {SubqlCustomDatasource, SubqlDatasource, SubqlRuntimeDatasource} from './project';

export interface EthereumNetworkModule extends INetworkCommonModule {
generateAbis?(
export interface EthereumNetworkModule
extends INetworkCommonModule<SubqlDatasource, SubqlRuntimeDatasource, SubqlCustomDatasource> {
generateAbis(
datasources: SubqlRuntimeDatasource[],
projectPath: string,
prepareDirPath: (path: string, recreate: boolean) => Promise<void>,
upperFirst: (input?: string) => string,
renderTemplate: (templatePath: string, outputPath: string, templateData: Data) => Promise<void>
): Promise<void>;
parseContractPath?(path: string): {name: string; rawName: string; path: string[]};
parseContractPath(path: string): {name: string; rawName: string; path: string[]};
}

0 comments on commit 8bb9bec

Please sign in to comment.