Bump dev (w/ ts-eslint updates) (#5691)
This commit is contained in:
@@ -26,7 +26,7 @@ async function run (ws: string): Promise<void> {
|
||||
api.runtimeMetadata.getUniqTypes(false);
|
||||
}
|
||||
|
||||
type ArgV = { ws: string };
|
||||
interface ArgV { ws: string }
|
||||
|
||||
export function main (): void {
|
||||
// retrieve and parse arguments - we do this globally, since this is a single command
|
||||
|
||||
@@ -70,7 +70,7 @@ async function generate (metaHex: HexString, pkg: string | undefined, output: st
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
type ArgV = { endpoint: string; output: string; package?: string; strict?: boolean };
|
||||
interface ArgV { endpoint: string; output: string; package?: string; strict?: boolean }
|
||||
|
||||
async function mainPromise (): Promise<void> {
|
||||
const { endpoint, output, package: pkg, strict: isStrict } = yargs(hideBin(process.argv)).strict().options({
|
||||
|
||||
@@ -16,7 +16,7 @@ import { generateInterfaceTypes } from './generate/interfaceRegistry.js';
|
||||
import { generateTsDef } from './generate/tsDef.js';
|
||||
import { assertDir, assertFile, getMetadataViaWs } from './util/index.js';
|
||||
|
||||
type ArgV = { input: string; package: string; endpoint?: string; };
|
||||
interface ArgV { input: string; package: string; endpoint?: string; }
|
||||
|
||||
async function mainPromise (): Promise<void> {
|
||||
const { endpoint, input, package: pkg } = yargs(hideBin(process.argv)).strict().options({
|
||||
|
||||
@@ -21,7 +21,7 @@ const primitiveClasses = {
|
||||
const generateInterfaceTypesTemplate = Handlebars.compile(readTemplate('interfaceRegistry'));
|
||||
|
||||
/** @internal */
|
||||
export function generateInterfaceTypes (importDefinitions: { [importPath: string]: Record<string, ModuleTypes> }, dest: string): void {
|
||||
export function generateInterfaceTypes (importDefinitions: Record<string, Record<string, ModuleTypes>>, dest: string): void {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
writeFile(dest, (): string => {
|
||||
|
||||
@@ -33,7 +33,7 @@ function getDefs (apis: Apis | null, defs: Record<string, Definitions>): Record<
|
||||
for (let i = 0, scount = sections.length; i < scount; i++) {
|
||||
const [_section, sec] = sections[i];
|
||||
const sectionHash = blake2AsHex(_section, 64);
|
||||
const api = apis && apis.find(([h]) => h === sectionHash);
|
||||
const api = apis?.find(([h]) => h === sectionHash);
|
||||
|
||||
if (api) {
|
||||
const ver = sec.find(({ version }) => version === api[1]);
|
||||
|
||||
@@ -253,7 +253,7 @@ function generateInterfaces (registry: Registry, definitions: Record<string, Mod
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function generateTsDefFor (registry: Registry, importDefinitions: { [importPath: string]: Record<string, ModuleTypes> }, defName: string, { types }: { types: Record<string, any> }, outputDir: string): void {
|
||||
export function generateTsDefFor (registry: Registry, importDefinitions: Record<string, Record<string, ModuleTypes>>, defName: string, { types }: { types: Record<string, any> }, outputDir: string): void {
|
||||
const imports = { ...createImports(importDefinitions, { types }), interfaces: [] } as Imports;
|
||||
const definitions = imports.definitions;
|
||||
const interfaces = generateInterfaces(registry, definitions, { types }, imports);
|
||||
@@ -275,7 +275,7 @@ export function generateTsDefFor (registry: Registry, importDefinitions: { [impo
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function generateTsDef (importDefinitions: { [importPath: string]: Record<string, ModuleTypes> }, outputDir: string, generatingPackage: string): void {
|
||||
export function generateTsDef (importDefinitions: Record<string, Record<string, ModuleTypes>>, outputDir: string, generatingPackage: string): void {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
writeFile(path.join(outputDir, 'types.ts'), (): string => {
|
||||
|
||||
@@ -92,7 +92,7 @@ function docsVecToMarkdown (docLines: Vec<Text>, indent = 0): string {
|
||||
.replace(/#### Weight:/g, 'Weight:');
|
||||
|
||||
// prefix each line with indentation
|
||||
return md && md.split('\n\n').map((line) => `${' '.repeat(indent)}${line}`).join('\n\n');
|
||||
return md?.split('\n\n').map((line) => `${' '.repeat(indent)}${line}`).join('\n\n');
|
||||
}
|
||||
|
||||
function renderPage (page: Page): string {
|
||||
@@ -169,7 +169,12 @@ function addRpc (_runtimeDesc: string, rpcMethods?: string[]): string {
|
||||
.keys(section.rpc || {})
|
||||
.sort()
|
||||
.forEach((methodName) => {
|
||||
const method = (section.rpc || {})[methodName];
|
||||
const method = section.rpc?.[methodName];
|
||||
|
||||
if (!method) {
|
||||
throw new Error(`No ${methodName} RPC found in ${_sectionName}`);
|
||||
}
|
||||
|
||||
const sectionName = method.aliasSection || _sectionName;
|
||||
const jsonrpc = (method.endpoint || `${sectionName}_${methodName}`);
|
||||
|
||||
@@ -455,7 +460,7 @@ function writeFile (name: string, ...chunks: any[]): void {
|
||||
writeStream.end();
|
||||
}
|
||||
|
||||
type ArgV = { chain?: string; endpoint?: string; };
|
||||
interface ArgV { chain?: string; endpoint?: string; }
|
||||
|
||||
async function mainPromise (): Promise<void> {
|
||||
const { chain, endpoint } = yargs(hideBin(process.argv)).strict().options({
|
||||
|
||||
@@ -11,7 +11,7 @@ export * from './initMeta.js';
|
||||
export * from './register.js';
|
||||
export * from './wsMeta.js';
|
||||
|
||||
type Cmp = { name: { toString(): string } };
|
||||
interface Cmp { name: { toString(): string } }
|
||||
|
||||
export function compareName (a: Cmp, b: Cmp): number {
|
||||
return a.name.toString().localeCompare(b.name.toString());
|
||||
|
||||
Reference in New Issue
Block a user