mirror of
https://github.com/pezkuwichain/pezkuwi-sdk-ui.git
synced 2026-04-21 23:47:59 +00:00
fix: Resolve TypeScript build errors for verbatimModuleSyntax compatibility
- Fix EventEmitter import in page-contracts/store.ts (use default import) - Add type declarations for eventemitter3 to fix ESM import type issue - Add type declarations for react-copy-to-clipboard to fix React types mismatch Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// Copyright 2017-2026 @pezkuwi/app-claims authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Type override for react-copy-to-clipboard to fix React types compatibility
|
||||
declare module 'react-copy-to-clipboard' {
|
||||
import * as React from 'react';
|
||||
|
||||
export interface Options {
|
||||
debug?: boolean;
|
||||
message?: string;
|
||||
format?: string;
|
||||
}
|
||||
|
||||
export interface Props {
|
||||
children: React.ReactNode;
|
||||
text: string;
|
||||
onCopy?(text: string, result: boolean): void;
|
||||
options?: Options;
|
||||
}
|
||||
|
||||
declare const CopyToClipboard: React.FC<Props>;
|
||||
export default CopyToClipboard;
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// Copyright 2017-2026 @pezkuwi/app-contracts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Type override for eventemitter3 to fix verbatimModuleSyntax ESM import issue
|
||||
declare module 'eventemitter3' {
|
||||
export type ValidEventTypes = string | symbol | object;
|
||||
|
||||
export type EventNames<T extends ValidEventTypes> = T extends string | symbol
|
||||
? T
|
||||
: keyof T;
|
||||
|
||||
export type EventListener<
|
||||
T extends ValidEventTypes,
|
||||
K extends EventNames<T>
|
||||
> = T extends string | symbol
|
||||
? (...args: any[]) => void
|
||||
: (...args: any[]) => void;
|
||||
|
||||
export type EventArgs<
|
||||
T extends ValidEventTypes,
|
||||
K extends EventNames<T>
|
||||
> = any[];
|
||||
|
||||
class EventEmitter<
|
||||
EventTypes extends ValidEventTypes = string | symbol,
|
||||
Context extends any = any
|
||||
> {
|
||||
static prefixed: string | boolean;
|
||||
|
||||
eventNames(): Array<EventNames<EventTypes>>;
|
||||
listeners<T extends EventNames<EventTypes>>(event: T): Array<EventListener<EventTypes, T>>;
|
||||
listenerCount(event: EventNames<EventTypes>): number;
|
||||
emit<T extends EventNames<EventTypes>>(event: T, ...args: EventArgs<EventTypes, T>): boolean;
|
||||
on<T extends EventNames<EventTypes>>(event: T, fn: EventListener<EventTypes, T>, context?: Context): this;
|
||||
addListener<T extends EventNames<EventTypes>>(event: T, fn: EventListener<EventTypes, T>, context?: Context): this;
|
||||
once<T extends EventNames<EventTypes>>(event: T, fn: EventListener<EventTypes, T>, context?: Context): this;
|
||||
removeListener<T extends EventNames<EventTypes>>(event: T, fn?: EventListener<EventTypes, T>, context?: Context, once?: boolean): this;
|
||||
off<T extends EventNames<EventTypes>>(event: T, fn?: EventListener<EventTypes, T>, context?: Context, once?: boolean): this;
|
||||
removeAllListeners(event?: EventNames<EventTypes>): this;
|
||||
}
|
||||
|
||||
export { EventEmitter };
|
||||
export default EventEmitter;
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { Hash } from '@pezkuwi/types/interfaces';
|
||||
import type { CodeJson, CodeStored } from './types.js';
|
||||
|
||||
import { EventEmitter } from 'eventemitter3';
|
||||
import EventEmitter from 'eventemitter3';
|
||||
import store from 'store';
|
||||
|
||||
import { Abi } from '@pezkuwi/api-contract';
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright 2017-2026 @pezkuwi/react-components authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Type override for react-copy-to-clipboard to fix React types compatibility
|
||||
declare module 'react-copy-to-clipboard' {
|
||||
import * as React from 'react';
|
||||
|
||||
export interface Options {
|
||||
debug?: boolean;
|
||||
message?: string;
|
||||
format?: string;
|
||||
}
|
||||
|
||||
export interface Props {
|
||||
children: React.ReactNode;
|
||||
text: string;
|
||||
onCopy?(text: string, result: boolean): void;
|
||||
options?: Options;
|
||||
}
|
||||
|
||||
declare const CopyToClipboard: React.FC<Props>;
|
||||
export default CopyToClipboard;
|
||||
}
|
||||
Reference in New Issue
Block a user