Bump TS to 5.0, adjust TS aliases (#9193)

* Adjust TS aliases (test-support problematic)

* Bump TS to 5

* Flatten paths (somewhat)
This commit is contained in:
Jaco 2023-03-17 10:16:43 +02:00 committed by GitHub
parent 9fb3742218
commit 043faeaac3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 95 additions and 76 deletions

View File

@ -121,6 +121,6 @@
"@polkadot/x-textencoder": "^11.0.2",
"@polkadot/x-ws": "^11.0.2",
"styled-components": "^5.3.1",
"typescript": "^4.9.5"
"typescript": "^5.0.2"
}
}

View File

@ -10,11 +10,10 @@ import i18next from '@polkadot/react-components/i18n';
import { toShortAddress } from '@polkadot/react-components/util';
import { AddressFlags } from '@polkadot/react-hooks/types';
import { anAccountWithBalance, anAccountWithBalanceAndMeta, anAccountWithInfo, anAccountWithInfoAndMeta, anAccountWithMeta, anAccountWithStaking } from '@polkadot/test-support/creation/account';
import { makeStakingLedger as ledger } from '@polkadot/test-support/creation/stakingInfo/stakingLedger';
import { alice, bob, MemoryStore } from '@polkadot/test-support/keyring/index';
import { Table } from '@polkadot/test-support/pagesElements/index';
import { balance, showBalance } from '@polkadot/test-support/utils/balance';
import { mockApiHooks } from '@polkadot/test-support/utils/mockApiHooks';
import { makeStakingLedger as ledger } from '@polkadot/test-support/creation/staking';
import { alice, bob, MemoryStore } from '@polkadot/test-support/keyring';
import { Table } from '@polkadot/test-support/pagesElements';
import { balance, mockApiHooks, showBalance } from '@polkadot/test-support/utils';
import { u32 } from '@polkadot/types';
import { TypeRegistry } from '@polkadot/types/create';
import { AccountId, Multisig, ProxyDefinition, Timepoint, Voting, VotingDelegating } from '@polkadot/types/interfaces';

View File

@ -13,9 +13,9 @@ import { ThemeProvider } from 'styled-components';
import AccountsApp from '@polkadot/app-accounts';
import { lightTheme } from '@polkadot/apps/themes';
import { ApiCtxRoot } from '@polkadot/react-api';
import { MemoryStore } from '@polkadot/test-support/keyring/index';
import { WaitForApi } from '@polkadot/test-support/react/index';
import { SUBSTRATE_PORT } from '@polkadot/test-support/substrate/index';
import { MemoryStore } from '@polkadot/test-support/keyring';
import { WaitForApi } from '@polkadot/test-support/react';
import { SUBSTRATE_PORT } from '@polkadot/test-support/substrate';
function noop (): void {
// do nothing

View File

@ -8,10 +8,10 @@ import { fireEvent, screen, waitFor, within } from '@testing-library/react';
import i18next from '@polkadot/react-components/i18n';
import { AddressFlags } from '@polkadot/react-hooks/types';
import { anAccount, anAccountWithInfo, anAccountWithMeta } from '@polkadot/test-support/creation/account';
import { alice, bob, MemoryStore } from '@polkadot/test-support/keyring/index';
import { charlieShortAddress, ferdieShortAddress, mockRegistration, registrars } from '@polkadot/test-support/mockData/registrations';
import { Sidebar } from '@polkadot/test-support/pagesElements/Sidebar';
import { mockApiHooks } from '@polkadot/test-support/utils/mockApiHooks';
import { alice, bob, MemoryStore } from '@polkadot/test-support/keyring';
import { charlieShortAddress, ferdieShortAddress, mockRegistration, registrars } from '@polkadot/test-support/mockData';
import { Sidebar } from '@polkadot/test-support/pagesElements';
import { mockApiHooks } from '@polkadot/test-support/utils';
import { RegistrationJudgement } from '@polkadot/types/interfaces';
import { keyring } from '@polkadot/ui-keyring';

View File

@ -6,8 +6,8 @@
import { fireEvent, screen, waitForElementToBeRemoved } from '@testing-library/react';
import i18next from '@polkadot/react-components/i18n';
import { MemoryStore } from '@polkadot/test-support/keyring/index';
import { assertButtonDisabled, assertText, clickButton, fillInput } from '@polkadot/test-support/utils/renderedScreenUtils';
import { MemoryStore } from '@polkadot/test-support/keyring';
import { assertButtonDisabled, assertText, clickButton, fillInput } from '@polkadot/test-support/utils';
import { keyring } from '@polkadot/ui-keyring';
import { cryptoWaitReady } from '@polkadot/util-crypto';

View File

@ -3,7 +3,7 @@
import { within } from '@testing-library/react';
import { Row } from '@polkadot/test-support/pagesElements/Row';
import { Row } from '@polkadot/test-support/pagesElements';
export class AccountRow extends Row {
async assertParentAccountName (expectedParentAccount: string): Promise<void> {

View File

@ -1,14 +1,15 @@
// Copyright 2017-2023 @polkadot/page-accounts authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AccountOverrides } from '@polkadot/test-support/types';
import { fireEvent, screen, within } from '@testing-library/react';
import React from 'react';
import { anAccount } from '@polkadot/test-support/creation/account';
import { Page } from '@polkadot/test-support/pages/Page';
import { Sidebar } from '@polkadot/test-support/pagesElements/Sidebar';
import { AccountOverrides } from '@polkadot/test-support/types';
import { assertText, clickButton } from '@polkadot/test-support/utils/renderedScreenUtils';
import { Sidebar } from '@polkadot/test-support/pagesElements';
import { assertText, clickButton } from '@polkadot/test-support/utils';
import { settings } from '@polkadot/ui-settings';
import AccountOverview from '../../src/Accounts/index.js';

View File

@ -7,9 +7,9 @@ import { screen } from '@testing-library/react';
import i18next from '@polkadot/react-components/i18n';
import { aContactWithBalance } from '@polkadot/test-support/creation/contact';
import { MemoryStore } from '@polkadot/test-support/keyring/index';
import { Table } from '@polkadot/test-support/pagesElements/index';
import { balance } from '@polkadot/test-support/utils/balance';
import { MemoryStore } from '@polkadot/test-support/keyring';
import { Table } from '@polkadot/test-support/pagesElements';
import { balance } from '@polkadot/test-support/utils';
import { keyring } from '@polkadot/ui-keyring';
import { AddressesPage } from '../../test/pages/addressesPage.js';

View File

@ -1,13 +1,14 @@
// Copyright 2017-2023 @polkadot/page-addresses authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AccountOverrides as ContactOverrides } from '@polkadot/test-support/types';
import React from 'react';
import { aContact } from '@polkadot/test-support/creation/contact';
import { Page } from '@polkadot/test-support/pages/Page';
import { Row } from '@polkadot/test-support/pagesElements/index';
import { AccountOverrides as ContactOverrides } from '@polkadot/test-support/types';
import { mockAccountHooks } from '@polkadot/test-support/utils/accountDefaults';
import { Row } from '@polkadot/test-support/pagesElements';
import { mockAccountHooks } from '@polkadot/test-support/utils';
import AddressOverview from '../../src/Contacts/index.js';

View File

@ -12,11 +12,10 @@ import { ThemeProvider } from 'styled-components';
import { lightTheme } from '@polkadot/apps/themes';
import { ApiCtxRoot } from '@polkadot/react-api';
import { createApi } from '@polkadot/test-support/api/index';
import { MemoryStore } from '@polkadot/test-support/keyring/index';
import { aliceSigner } from '@polkadot/test-support/keyring/signers';
import { WaitForApi } from '@polkadot/test-support/react/index';
import { execute } from '@polkadot/test-support/transaction/execute';
import { createApi } from '@polkadot/test-support/api';
import { aliceSigner, MemoryStore } from '@polkadot/test-support/keyring';
import { WaitForApi } from '@polkadot/test-support/react';
import { execute } from '@polkadot/test-support/transaction';
import { BN } from '@polkadot/util';
import BountiesApp from './index.js';

View File

@ -12,13 +12,12 @@ import { fireEvent } from '@testing-library/react';
import { ApiPromise } from '@polkadot/api';
import i18next from '@polkadot/react-components/i18n';
import { createAugmentedApi } from '@polkadot/test-support/api/index';
import { createAugmentedApi } from '@polkadot/test-support/api';
import { balanceOf } from '@polkadot/test-support/creation/balance';
import { BountyFactory } from '@polkadot/test-support/creation/bounties/bountyFactory';
import { proposalFactory } from '@polkadot/test-support/creation/treasury/proposalFactory';
import { mockHooks } from '@polkadot/test-support/hooks/mockHooks';
import { alice, bob } from '@polkadot/test-support/keyring/addresses';
import { MemoryStore } from '@polkadot/test-support/keyring/index';
import { BountyFactory } from '@polkadot/test-support/creation/bounties';
import { proposalFactory } from '@polkadot/test-support/creation/treasury';
import { mockHooks } from '@polkadot/test-support/hooks';
import { alice, bob, MemoryStore } from '@polkadot/test-support/keyring';
import { keyring } from '@polkadot/ui-keyring';
import { BN } from '@polkadot/util';

View File

@ -3,8 +3,8 @@
/// <reference types="@polkadot/dev-test/globals" />
import { createAugmentedApi } from '@polkadot/test-support/api/index';
import { BountyFactory } from '@polkadot/test-support/creation/bounties/bountyFactory';
import { createAugmentedApi } from '@polkadot/test-support/api';
import { BountyFactory } from '@polkadot/test-support/creation/bounties';
import { BN } from '@polkadot/util';
import { determineUnassignCuratorAction } from './determineUnassignCuratorAction.js';

View File

@ -18,7 +18,7 @@ import { ApiProps } from '@polkadot/react-api/types';
import { KeyringCtxRoot } from '@polkadot/react-hooks';
import { QueueCtx } from '@polkadot/react-hooks/ctx/Queue';
import { balanceOf } from '@polkadot/test-support/creation/balance';
import { BountyFactory } from '@polkadot/test-support/creation/bounties/bountyFactory';
import { BountyFactory } from '@polkadot/test-support/creation/bounties';
import { TypeRegistry } from '@polkadot/types/create';
import { BountyIndex, BountyStatus } from '@polkadot/types/interfaces';

View File

@ -1,8 +1,8 @@
// Copyright 2017-2023 @polkadot/test-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { createApi } from '@polkadot/test-support/api/index';
import { aliceSigner } from '@polkadot/test-support/keyring/index';
import { createApi } from '@polkadot/test-support/api';
import { aliceSigner } from '@polkadot/test-support/keyring';
import { multiAcceptCurator, multiApproveBounty, multiAwardBounty, multiClaimBounty, multiProposeBounty, multiProposeCurator, multiWaitForBountyFunded, multiWaitForClaim } from './lib/multiFunctions.js';

View File

@ -1,9 +1,11 @@
// Copyright 2017-2023 @polkadot/test-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DeriveBounty } from '@polkadot/api-derive/types';
import type { WaitOptions } from '@polkadot/test-support/types';
import { ApiPromise } from '@polkadot/api';
import { DeriveBounty } from '@polkadot/api-derive/types';
import { waitFor, WaitOptions } from '@polkadot/test-support/utils/waitFor';
import { waitFor } from '@polkadot/test-support/utils';
type bStatus = 'isFunded' | 'isActive';

View File

@ -5,7 +5,7 @@ import type { ApiPromise } from '@polkadot/api';
import type { KeyringPair } from '@polkadot/keyring/types';
import type { BN } from '@polkadot/util';
import { execute } from '@polkadot/test-support/transaction/index';
import { execute } from '@polkadot/test-support/transaction';
import { acceptMotion, fillTreasury, getMotion, proposeMotion } from './helpers.js';

View File

@ -5,8 +5,8 @@ import { ApiPromise } from '@polkadot/api';
import { SubmittableExtrinsic } from '@polkadot/api/types';
import { DeriveCollectiveProposal } from '@polkadot/api-derive/types';
import { KeyringPair } from '@polkadot/keyring/types';
import { charlieSigner, daveSigner, eveSigner, ferdieSigner } from '@polkadot/test-support/keyring/index';
import { execute } from '@polkadot/test-support/transaction/index';
import { charlieSigner, daveSigner, eveSigner, ferdieSigner } from '@polkadot/test-support/keyring';
import { execute } from '@polkadot/test-support/transaction';
import { Hash } from '@polkadot/types/interfaces';
import { BN } from '@polkadot/util';

View File

@ -3,7 +3,7 @@
import { ApiPromise } from '@polkadot/api';
import { KeyringPair } from '@polkadot/keyring/types';
import { execute } from '@polkadot/test-support/transaction/index';
import { execute } from '@polkadot/test-support/transaction';
import { BN } from '@polkadot/util';
import { waitForBountyState, waitForClaim } from './bountyWaitFunctions.js';

View File

@ -6,7 +6,7 @@ import { BountyIndex, BountyStatus } from '@polkadot/types/interfaces';
import { PalletBountiesBounty } from '@polkadot/types/lookup';
import { Registry } from '@polkadot/types/types';
import { balanceOf } from '../balance.js';
import { balanceOf } from './balance.js';
export class BountyFactory {
readonly #api: ApiPromise;

View File

@ -1,13 +1,15 @@
// Copyright 2017-2023 @polkadot/test-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { SubmittableExtrinsic } from '@polkadot/api/types';
import type { DeriveCollectiveProposal } from '@polkadot/api-derive/types';
import { ApiPromise } from '@polkadot/api';
import { SubmittableExtrinsic } from '@polkadot/api/types';
import { BN_ONE, BN_ZERO } from '@polkadot/util';
import { alice, bob } from '../../keyring/addresses.js';
import { aHash } from '../hashes.js';
import { alice, bob } from '../keyring/addresses.js';
import { balanceOf } from './balance.js';
import { aHash } from './hashes.js';
export interface ProposalFactory {
aProposal: (extrinsic: SubmittableExtrinsic<'promise'>, ayes?: string[], nays?: string[]) => DeriveCollectiveProposal
@ -29,3 +31,9 @@ export function proposalFactory (api: ApiPromise): ProposalFactory {
})
};
}
export const defaultTreasury = {
burn: BN_ONE,
spendPeriod: BN_ZERO,
value: balanceOf(1)
};

View File

@ -1,12 +0,0 @@
// Copyright 2017-2023 @polkadot/test-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BN_ONE, BN_ZERO } from '@polkadot/util';
import { balanceOf } from '../balance.js';
export const defaultTreasury = {
burn: BN_ONE,
spendPeriod: BN_ZERO,
value: balanceOf(1)
};

View File

@ -3,7 +3,7 @@
import { extractTime } from '@polkadot/util';
import { defaultTreasury } from '../creation/treasury/defaults.js';
import { defaultTreasury } from '../creation/treasury.js';
import { defaultMembers } from '../keyring/addresses.js';
export const mockHooks = {

View File

@ -1,6 +1,7 @@
// Copyright 2017-2023 @polkadot/test-supports authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './JudgementTag.js';
export * from './Row.js';
export * from './Sidebar.js';
export * from './Table.js';

View File

@ -15,3 +15,5 @@ export interface AccountOverrides {
staking?: Override<DeriveStakingAccount>;
info?: Override<UseAccountInfo>;
}
export type WaitOptions = { interval?: number, timeout?: number };

View File

@ -9,7 +9,7 @@ import type { KeyringJson$Meta } from '@polkadot/ui-keyring/types';
import { BN } from '@polkadot/util';
import { balanceOf } from '../creation/balance.js';
import { makeStakingLedger } from '../creation/stakingInfo/stakingLedger.js';
import { makeStakingLedger } from '../creation/staking.js';
export interface Account {
balance: DeriveBalancesAll,

View File

@ -0,0 +1,8 @@
// Copyright 2017-2023 @polkadot/test-supports authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './accountDefaults.js';
export * from './balance.js';
export * from './mockApiHooks.js';
export * from './renderedScreenUtils.js';
export * from './waitFor.js';

View File

@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/test-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
export type WaitOptions = { interval?: number, timeout?: number };
import type { WaitOptions } from '../types.js';
export async function waitFor (predicate: () => Promise<boolean> | boolean, { interval = 500, timeout = 10000 } = {}): Promise<boolean> {
export async function waitFor (predicate: () => Promise<boolean> | boolean, { interval = 500, timeout = 10000 }: WaitOptions = {}): Promise<boolean> {
const asyncPredicate = () => Promise.resolve(predicate());
let elapsed = 0;

View File

@ -106,7 +106,18 @@
"@polkadot/react-query": ["react-query/src/index.ts"],
"@polkadot/react-signer": ["react-signer/src/index.tsx"],
"@polkadot/react-signer/signers/*": ["react-signer/src/signers/*.ts"],
"@polkadot/test-support/*": ["test-support/src/*.ts", "test-support/src/*.tsx"]
"@polkadot/test-support/api": ["test-support/src/api/index.ts"],
"@polkadot/test-support/creation/*": ["test-support/src/creation/*.ts"],
"@polkadot/test-support/hooks": ["test-support/src/hooks/index.ts"],
"@polkadot/test-support/keyring": ["test-support/src/keyring/index.ts"],
"@polkadot/test-support/mockData": ["test-support/src/mockData/index.ts"],
"@polkadot/test-support/pages/*": ["test-support/src/pages/*.tsx"],
"@polkadot/test-support/pagesElements": ["test-support/src/pagesElements/index.ts"],
"@polkadot/test-support/react": ["test-support/src/react/index.ts"],
"@polkadot/test-support/substrate": ["test-support/src/substrate/index.ts"],
"@polkadot/test-support/types": ["test-support/src/types.ts"],
"@polkadot/test-support/transaction": ["test-support/src/transaction/index.ts"],
"@polkadot/test-support/utils": ["test-support/src/utils/index.ts"]
},
"skipLibCheck": true
}

View File

@ -17067,23 +17067,23 @@ fsevents@~2.3.2:
languageName: node
linkType: hard
"typescript@npm:^4.9.5":
version: 4.9.5
resolution: "typescript@npm:4.9.5"
"typescript@npm:^5.0.2":
version: 5.0.2
resolution: "typescript@npm:5.0.2"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: ee000bc26848147ad423b581bd250075662a354d84f0e06eb76d3b892328d8d4440b7487b5a83e851b12b255f55d71835b008a66cbf8f255a11e4400159237db
checksum: bef1dcd166acfc6934b2ec4d72f93edb8961a5fab36b8dd2aaf6f4f4cd5c0210f2e0850aef4724f3b4913d5aef203a94a28ded731b370880c8bcff7e4ff91fc1
languageName: node
linkType: hard
"typescript@patch:typescript@npm%3A^4.9.5#~builtin<compat/typescript>":
version: 4.9.5
resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin<compat/typescript>::version=4.9.5&hash=bda367"
"typescript@patch:typescript@npm%3A^5.0.2#~builtin<compat/typescript>":
version: 5.0.2
resolution: "typescript@patch:typescript@npm%3A5.0.2#~builtin<compat/typescript>::version=5.0.2&hash=bda367"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 2eee5c37cad4390385db5db5a8e81470e42e8f1401b0358d7390095d6f681b410f2c4a0c496c6ff9ebd775423c7785cdace7bcdad76c7bee283df3d9718c0f20
checksum: bdbf3d0aac0d6cf010fbe0536753dc19f278eb4aba88140dcd25487dfe1c56ca8b33abc0dcd42078790a939b08ebc4046f3e9bb961d77d3d2c3cfa9829da4d53
languageName: node
linkType: hard