fix type check

This commit is contained in:
liangping 2023-06-17 14:02:44 +08:00
parent a1635675d3
commit add9109789
2 changed files with 11 additions and 10 deletions

View File

@ -3,7 +3,7 @@ import { defineStore } from 'pinia';
import {useBlockchain} from '@/stores' import {useBlockchain} from '@/stores'
import ChainRegistryClient from '@ping-pub/chain-registry-client'; import ChainRegistryClient from '@ping-pub/chain-registry-client';
import type { IBCPath } from '@ping-pub/chain-registry-client/dist/types'; import type { IBCPath, IBCInfo, } from '@ping-pub/chain-registry-client/dist/types';
import type { Channel } from '@/types'; import type { Channel } from '@/types';
import router from '@/router'; import router from '@/router';
@ -11,24 +11,24 @@ export const useIBCModule = defineStore('module-ibc', {
state: () => { state: () => {
return { return {
paths: [] as IBCPath[], paths: [] as IBCPath[],
connectionId: "", connectionId: "" as string,
registryConf: {}, registryConf: {} as IBCInfo,
}; };
}, },
getters: { getters: {
chain() { chain() {
return useBlockchain() return useBlockchain()
}, },
commonIBCs() { commonIBCs(): any {
return this.paths.filter(x => x.path.search(this.chain.current?.prettyName || this.chain.chainName) > -1) return this.paths.filter((x: IBCPath) => x.path.search(this.chain.current?.prettyName || this.chain.chainName) > -1)
}, },
sourceField() { sourceField(): string {
return this.registryConf?.chain_1?.chain_name === this.chain.current?.prettyName || this.chain.chainName ? 'chain_1': 'chain_2' return this.registryConf?.chain_1?.chain_name === this.chain.current?.prettyName || this.chain.chainName ? 'chain_1': 'chain_2'
}, },
destField() { destField() : string {
return this.registryConf?.chain_1?.chain_name === this.chain.current?.prettyName || this.chain.chainName ? 'chain_2': 'chain_1' return this.registryConf?.chain_1?.chain_name === this.chain.current?.prettyName || this.chain.chainName ? 'chain_2': 'chain_1'
}, },
registryChannels() { registryChannels(): any {
return this.registryConf.channels return this.registryConf.channels
} }
}, },
@ -50,7 +50,7 @@ export const useIBCModule = defineStore('module-ibc', {
}, },
showConnection(connId?: string | number) { showConnection(connId?: string | number) {
if(!connId) { if(!connId) {
this.registryConf = {} this.registryConf = {} as any
} }
const path = `/${this.chain.chainName}/ibc/connection/${connId || `connection-${this.connectionId || 0}`}` const path = `/${this.chain.chainName}/ibc/connection/${connId || `connection-${this.connectionId || 0}`}`
router.push(path) router.push(path)

View File

@ -1,7 +1,8 @@
{ {
"extends": "@vue/tsconfig/tsconfig.web.json", "extends": "@vue/tsconfig/tsconfig.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"], "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"compilerOptions": { "compilerOptions": {
"ignoreDeprecations": "5.0",
"lib": [ "lib": [
"es2022", "es2022",
"dom" "dom"