mirror of
https://github.com/pezkuwichain/pezkuwi-api.git
synced 2026-11-25 15:09:57 +00:00
Move to @pezkuwi/dev 0.86 (eslint 10 toolchain)
- @pezkuwi/dev, dev-test, dev-ts ^0.86.3; disable directives renamed for the new rule names, or removed where the rule no longer reports - rethrown errors carry the original as `cause` (13 sites) - optional chains where a guard expression tested the same value - Init: the registry cache settles with the creator's own promise, dropping the entry in finally(), instead of re-wrapping it - Combinator: a typed call instead of `Function` - checkTypes.manual: synchronous checks run outside Promise.all - sortValues, createTypeUnsafe: initial values that were never read - typegen util: load docs.js for its side effect (it registers the `docs` Handlebars partial) now that its types are re-exported type-only - MockProvider keeps its Header assertion: the package's own build does not load api-augment, so createType returns a plain Codec there - Decorate keeps `delete queue[i]`: the hole marks a fired queue and later indexes must not shift
This commit is contained in:
1 parent
8c9af013b5
commit
5835a5383c
166 files changed
+2757
-3731
No files matched your search
@@ -150,7 +150,7 @@ export class ApiPromise extends ApiBase<'promise'> {
|
||||
public static create (options?: ApiOptions): Promise<ApiPromise> {
|
||||
const instance = new ApiPromise(options);
|
||||
|
||||
if (options && options.throwOnConnect) {
|
||||
if (options?.throwOnConnect) {
|
||||
return instance.isReadyOrError;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ export class Combinator<T extends unknown[] = unknown[]> {
|
||||
constructor (fns: (CombinatorFunction | [CombinatorFunction, ...unknown[]])[], callback: CombinatorCallback<T>) {
|
||||
this.#callback = callback;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises, @typescript-eslint/require-await
|
||||
this.#subscriptions = fns.map(async (input, index): UnsubscribePromise => {
|
||||
const [fn, ...args] = Array.isArray(input)
|
||||
? input
|
||||
@@ -31,9 +30,8 @@ export class Combinator<T extends unknown[] = unknown[]> {
|
||||
this.#fired.push(false);
|
||||
this.#fns.push(fn);
|
||||
|
||||
// Not quite 100% how to have a variable number at the front here
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/ban-types
|
||||
return (fn as Function)(...args, this._createCallback(index));
|
||||
// the leading arguments vary per function, the callback is always last
|
||||
return (fn as (...params: unknown[]) => UnsubscribePromise)(...args, this._createCallback(index));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,6 @@ describe('Combinator', (): void => {
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('unsubscribes as required', async (): Promise<void> => {
|
||||
await new Promise<void>((resolve) => {
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
const mocker = () => Promise.resolve(resolve);
|
||||
const combinator = new Combinator([
|
||||
mocker,
|
||||
|
||||
@@ -106,7 +106,7 @@ function decorateSubscribe<M extends DecorateFn<CodecReturnType<M>>> (method: M,
|
||||
* @description Decorate method for ApiPromise, where the results are converted to the Promise equivalent
|
||||
*/
|
||||
export function toPromiseMethod<M extends DecorateFn<CodecReturnType<M>>> (method: M, options?: DecorateMethodOptions): StorageEntryPromiseOverloads {
|
||||
const needsCallback = !!(options?.methodName && options.methodName.includes('subscribe'));
|
||||
const needsCallback = !!(options?.methodName?.includes('subscribe'));
|
||||
|
||||
return function (...args: unknown[]): Promise<CodecReturnType<M>> | UnsubscribePromise {
|
||||
const [actualArgs, resultCb] = extractArgs(args, needsCallback);
|
||||
|
||||
Reference in new issue
Block a user