dart-archive / js_facade_gen

Generates package:js Javascript interop facades for arbitrary TypeScript libraries
Apache License 2.0
161 stars 29 forks source link

Unsupported node type ComputedPropertyName #104

Open hrabkin opened 2 years ago

hrabkin commented 2 years ago

File to transpile

import { AlertButton } from './ui/alert/Alert';
import { ExtendedP2PPairingResponse } from './types/P2PPairingResponse';
import { PostMessagePairingRequest } from './types/PostMessagePairingRequest';
import { ExtendedPostMessagePairingResponse } from './types/PostMessagePairingResponse';
import { BlockExplorer } from './utils/block-explorer';
import { P2PPairingRequest, AccountInfo, ErrorResponse, PermissionResponseOutput, OperationResponseOutput, BroadcastResponseOutput, SignPayloadResponseOutput, Network, ConnectionContext, Transport, NetworkType, AcknowledgeResponse } from '.';
/**
 * The different events that can be emitted by the beacon-sdk
 */
export declare enum BeaconEvent {
    PERMISSION_REQUEST_SENT = "PERMISSION_REQUEST_SENT",
    PERMISSION_REQUEST_SUCCESS = "PERMISSION_REQUEST_SUCCESS",
    PERMISSION_REQUEST_ERROR = "PERMISSION_REQUEST_ERROR",
    OPERATION_REQUEST_SENT = "OPERATION_REQUEST_SENT",
    OPERATION_REQUEST_SUCCESS = "OPERATION_REQUEST_SUCCESS",
    OPERATION_REQUEST_ERROR = "OPERATION_REQUEST_ERROR",
    SIGN_REQUEST_SENT = "SIGN_REQUEST_SENT",
    SIGN_REQUEST_SUCCESS = "SIGN_REQUEST_SUCCESS",
    SIGN_REQUEST_ERROR = "SIGN_REQUEST_ERROR",
    BROADCAST_REQUEST_SENT = "BROADCAST_REQUEST_SENT",
    BROADCAST_REQUEST_SUCCESS = "BROADCAST_REQUEST_SUCCESS",
    BROADCAST_REQUEST_ERROR = "BROADCAST_REQUEST_ERROR",
    ACKNOWLEDGE_RECEIVED = "ACKNOWLEDGE_RECEIVED",
    LOCAL_RATE_LIMIT_REACHED = "LOCAL_RATE_LIMIT_REACHED",
    NO_PERMISSIONS = "NO_PERMISSIONS",
    ACTIVE_ACCOUNT_SET = "ACTIVE_ACCOUNT_SET",
    ACTIVE_TRANSPORT_SET = "ACTIVE_TRANSPORT_SET",
    SHOW_PREPARE = "SHOW_PREPARE",
    HIDE_UI = "HIDE_UI",
    PAIR_INIT = "PAIR_INIT",
    PAIR_SUCCESS = "PAIR_SUCCESS",
    CHANNEL_CLOSED = "CHANNEL_CLOSED",
    INTERNAL_ERROR = "INTERNAL_ERROR",
    UNKNOWN = "UNKNOWN"
}
export interface WalletInfo {
    name: string;
    type?: 'extension' | 'mobile' | 'web' | 'desktop';
    icon?: string;
    deeplink?: string;
}
export interface ExtraInfo {
    resetCallback?(): Promise<void>;
}
interface RequestSentInfo {
    extraInfo: ExtraInfo;
    walletInfo: WalletInfo;
}
/**
 * The type of the payload of the different BeaconEvents
 */
export interface BeaconEventType {
    [BeaconEvent.PERMISSION_REQUEST_SENT]: RequestSentInfo;
    [BeaconEvent.PERMISSION_REQUEST_SUCCESS]: {
        account: AccountInfo;
        output: PermissionResponseOutput;
        blockExplorer: BlockExplorer;
        connectionContext: ConnectionContext;
        walletInfo: WalletInfo;
    };
    [BeaconEvent.PERMISSION_REQUEST_ERROR]: {
        errorResponse: ErrorResponse;
        walletInfo: WalletInfo;
    };
    [BeaconEvent.OPERATION_REQUEST_SENT]: RequestSentInfo;
    [BeaconEvent.OPERATION_REQUEST_SUCCESS]: {
        account: AccountInfo;
        output: OperationResponseOutput;
        blockExplorer: BlockExplorer;
        connectionContext: ConnectionContext;
        walletInfo: WalletInfo;
    };
    [BeaconEvent.OPERATION_REQUEST_ERROR]: {
        errorResponse: ErrorResponse;
        walletInfo: WalletInfo;
    };
    [BeaconEvent.SIGN_REQUEST_SENT]: RequestSentInfo;
    [BeaconEvent.SIGN_REQUEST_SUCCESS]: {
        output: SignPayloadResponseOutput;
        connectionContext: ConnectionContext;
        walletInfo: WalletInfo;
    };
    [BeaconEvent.SIGN_REQUEST_ERROR]: {
        errorResponse: ErrorResponse;
        walletInfo: WalletInfo;
    };
    [BeaconEvent.BROADCAST_REQUEST_SENT]: RequestSentInfo;
    [BeaconEvent.BROADCAST_REQUEST_SUCCESS]: {
        network: Network;
        output: BroadcastResponseOutput;
        blockExplorer: BlockExplorer;
        connectionContext: ConnectionContext;
        walletInfo: WalletInfo;
    };
    [BeaconEvent.BROADCAST_REQUEST_ERROR]: {
        errorResponse: ErrorResponse;
        walletInfo: WalletInfo;
    };
    [BeaconEvent.ACKNOWLEDGE_RECEIVED]: {
        message: AcknowledgeResponse;
        extraInfo: ExtraInfo;
        walletInfo: WalletInfo;
    };
    [BeaconEvent.LOCAL_RATE_LIMIT_REACHED]: undefined;
    [BeaconEvent.NO_PERMISSIONS]: undefined;
    [BeaconEvent.ACTIVE_ACCOUNT_SET]: AccountInfo;
    [BeaconEvent.ACTIVE_TRANSPORT_SET]: Transport;
    [BeaconEvent.SHOW_PREPARE]: {
        walletInfo?: WalletInfo;
    };
    [BeaconEvent.HIDE_UI]: ('alert' | 'toast')[] | undefined;
    [BeaconEvent.PAIR_INIT]: {
        p2pPeerInfo: () => Promise<P2PPairingRequest>;
        postmessagePeerInfo: () => Promise<PostMessagePairingRequest>;
        preferredNetwork: NetworkType;
        abortedHandler?(): void;
        disclaimerText?: string;
    };
    [BeaconEvent.PAIR_SUCCESS]: ExtendedPostMessagePairingResponse | ExtendedP2PPairingResponse;
    [BeaconEvent.CHANNEL_CLOSED]: string;
    [BeaconEvent.INTERNAL_ERROR]: {
        text: string;
        buttons?: AlertButton[];
    };
    [BeaconEvent.UNKNOWN]: undefined;
}
export declare type BeaconEventHandlerFunction<T = unknown> = (data: T, eventCallback?: AlertButton[]) => void | Promise<void>;
/**
 * The default event handlers
 */
export declare const defaultEventCallbacks: {
    [key in BeaconEvent]: BeaconEventHandlerFunction<BeaconEventType[key]>;
};
/**
 * @internalapi
 *
 * Handles beacon events
 */
export declare class BeaconEventHandler {
    private readonly callbackMap;
    constructor(eventsToOverride?: {
        [key in BeaconEvent]?: {
            handler: BeaconEventHandlerFunction<BeaconEventType[key]>;
        };
    }, overrideAll?: boolean);
    /**
     * A method to subscribe to a specific beacon event and register a callback
     *
     * @param event The event being emitted
     * @param eventCallback The callback that will be invoked
     */
    on<K extends BeaconEvent>(event: K, eventCallback: BeaconEventHandlerFunction<BeaconEventType[K]>): Promise<void>;
    /**
     * Emit a beacon event
     *
     * @param event The event being emitted
     * @param data The data to be emit
     */
    emit<K extends BeaconEvent>(event: K, data?: BeaconEventType[K], eventCallback?: AlertButton[]): Promise<void>;
    /**
     * Override beacon event default callbacks. This can be used to disable default alert/toast behaviour
     *
     * @param eventsToOverride An object with the events to override
     */
    private overrideDefaults;
    /**
     * Set all event callbacks to a specific handler.
     */
    private setAllHandlers;
}
export {};

I am seeing the following error in console:

../esm/events.d.ts:53:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PERMISSION_REQUEST_SENT]
../esm/events.d.ts:53:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PERMISSION_REQUEST_SENT]
../esm/events.d.ts:54:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PERMISSION_REQUEST_SUCCESS]
../esm/events.d.ts:54:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PERMISSION_REQUEST_SUCCESS]
../esm/events.d.ts:61:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PERMISSION_REQUEST_ERROR]
../esm/events.d.ts:61:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PERMISSION_REQUEST_ERROR]
../esm/events.d.ts:65:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.OPERATION_REQUEST_SENT]
../esm/events.d.ts:65:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.OPERATION_REQUEST_SENT]
../esm/events.d.ts:66:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.OPERATION_REQUEST_SUCCESS]
../esm/events.d.ts:66:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.OPERATION_REQUEST_SUCCESS]
../esm/events.d.ts:73:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.OPERATION_REQUEST_ERROR]
../esm/events.d.ts:73:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.OPERATION_REQUEST_ERROR]
../esm/events.d.ts:77:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.SIGN_REQUEST_SENT]
../esm/events.d.ts:77:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.SIGN_REQUEST_SENT]
../esm/events.d.ts:78:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.SIGN_REQUEST_SUCCESS]
../esm/events.d.ts:78:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.SIGN_REQUEST_SUCCESS]
../esm/events.d.ts:83:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.SIGN_REQUEST_ERROR]
../esm/events.d.ts:83:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.SIGN_REQUEST_ERROR]
../esm/events.d.ts:87:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.BROADCAST_REQUEST_SENT]
../esm/events.d.ts:87:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.BROADCAST_REQUEST_SENT]
../esm/events.d.ts:88:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.BROADCAST_REQUEST_SUCCESS]
../esm/events.d.ts:88:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.BROADCAST_REQUEST_SUCCESS]
../esm/events.d.ts:95:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.BROADCAST_REQUEST_ERROR]
../esm/events.d.ts:95:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.BROADCAST_REQUEST_ERROR]
../esm/events.d.ts:99:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.ACKNOWLEDGE_RECEIVED]
../esm/events.d.ts:99:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.ACKNOWLEDGE_RECEIVED]
../esm/events.d.ts:104:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.LOCAL_RATE_LIMIT_REACHED]
../esm/events.d.ts:104:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.LOCAL_RATE_LIMIT_REACHED]
../esm/events.d.ts:105:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.NO_PERMISSIONS]
../esm/events.d.ts:105:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.NO_PERMISSIONS]
../esm/events.d.ts:106:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.ACTIVE_ACCOUNT_SET]
../esm/events.d.ts:106:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.ACTIVE_ACCOUNT_SET]
../esm/events.d.ts:107:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.ACTIVE_TRANSPORT_SET]
../esm/events.d.ts:107:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.ACTIVE_TRANSPORT_SET]
../esm/events.d.ts:108:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.SHOW_PREPARE]
../esm/events.d.ts:108:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.SHOW_PREPARE]
../esm/events.d.ts:111:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.HIDE_UI]
../esm/events.d.ts:111:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.HIDE_UI]
../esm/events.d.ts:112:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PAIR_INIT]
../esm/events.d.ts:112:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PAIR_INIT]
../esm/events.d.ts:119:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PAIR_SUCCESS]
../esm/events.d.ts:119:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PAIR_SUCCESS]
../esm/events.d.ts:120:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.CHANNEL_CLOSED]
../esm/events.d.ts:120:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.CHANNEL_CLOSED]
../esm/events.d.ts:121:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.INTERNAL_ERROR]
../esm/events.d.ts:121:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.INTERNAL_ERROR]
../esm/events.d.ts:125:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.UNKNOWN]
../esm/events.d.ts:125:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.UNKNOWN]
../esm/events.d.ts:53:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PERMISSION_REQUEST_SENT]
../esm/events.d.ts:54:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PERMISSION_REQUEST_SUCCESS]
../esm/events.d.ts:61:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PERMISSION_REQUEST_ERROR]
../esm/events.d.ts:65:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.OPERATION_REQUEST_SENT]
../esm/events.d.ts:66:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.OPERATION_REQUEST_SUCCESS]
../esm/events.d.ts:73:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.OPERATION_REQUEST_ERROR]
../esm/events.d.ts:77:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.SIGN_REQUEST_SENT]
../esm/events.d.ts:78:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.SIGN_REQUEST_SUCCESS]
../esm/events.d.ts:83:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.SIGN_REQUEST_ERROR]
../esm/events.d.ts:87:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.BROADCAST_REQUEST_SENT]
../esm/events.d.ts:88:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.BROADCAST_REQUEST_SUCCESS]
../esm/events.d.ts:95:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.BROADCAST_REQUEST_ERROR]
../esm/events.d.ts:99:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.ACKNOWLEDGE_RECEIVED]
../esm/events.d.ts:104:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.LOCAL_RATE_LIMIT_REACHED]
../esm/events.d.ts:105:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.NO_PERMISSIONS]
../esm/events.d.ts:106:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.ACTIVE_ACCOUNT_SET]
../esm/events.d.ts:107:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.ACTIVE_TRANSPORT_SET]
../esm/events.d.ts:108:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.SHOW_PREPARE]
../esm/events.d.ts:111:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.HIDE_UI]
../esm/events.d.ts:112:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PAIR_INIT]
../esm/events.d.ts:119:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.PAIR_SUCCESS]
../esm/events.d.ts:120:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.CHANNEL_CLOSED]
../esm/events.d.ts:121:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.INTERNAL_ERROR]
../esm/events.d.ts:125:5: Unsupported node type ComputedPropertyName: 
    [BeaconEvent.UNKNOWN]
../esm/events.d.ts:1:1: Could not format because the source could not be parsed:

line 29, column 52: Fields can't be declared to be 'external'.
   ╷
29 │  @anonymous @JS() abstract class BeaconEventType { external RequestSentInfo get; 
   │                                                    ^^^^^^^^
   ╵
line 31, column 2: Fields can't be declared to be 'external'.
   ╷
31 │  external dynamic/*{
   │  ^^^^^^^^
   ╵
line 45, column 2: Fields can't be declared to be 'external'.
   ╷
45 │  external dynamic/*{
   │  ^^^^^^^^
   ╵
line 53, column 2: Fields can't be declared to be 'external'.
   ╷
53 │  external RequestSentInfo get; 
   │  ^^^^^^^^
   ╵
line 55, column 2: Fields can't be declared to be 'external'.
   ╷
55 │  external dynamic/*{
   │  ^^^^^^^^
   ╵
line 69, column 2: Fields can't be declared to be 'external'.
   ╷
69 │  external dynamic/*{
   │  ^^^^^^^^
   ╵
line 77, column 2: Fields can't be declared to be 'external'.
   ╷
77 │  external RequestSentInfo get; 
   │  ^^^^^^^^
   ╵
line 79, column 2: Fields can't be declared to be 'external'.
   ╷
79 │  external dynamic/*{
   │  ^^^^^^^^
   ╵
line 89, column 2: Fields can't be declared to be 'external'.
   ╷
89 │  external dynamic/*{
   │  ^^^^^^^^
   ╵
line 97, column 2: Fields can't be declared to be 'external'.
   ╷
97 │  external RequestSentInfo get; 
   │  ^^^^^^^^
   ╵
(14 more errors...)

Any hints how to resolve the issue?