abandonware/wireless-tools

TypeScript Compiler Error (TS2304) - Cannot find name 'TypeOrPromise'

qMalte opened this issue · 0 comments

Hello together,

I would like to use the libary in my NodeJS (TypeScript) project, however my compilation process is completing with errors.

My SourceCode

`
import {hostapd, ifconfig, iwconfig, udhcpd} from "@loofkid/wireless-tools";

export class ApService {

private options = {
    channel: 6,
    driver: 'rtl871xdrv',
    hw_mode: 'g',
    interface: 'wlan0',
    ssid: 'XXX',
    wpa: 2,
    wpa_passphrase: 'XXX'
};

private ifConfigOptions = {
    interface: 'wlan0',
    ipv4_address: '192.168.10.1',
    ipv4_broadcast: '192.168.10.255',
    ipv4_subnet_mask: '255.255.255.0'
};

private dhcpOptions = {
    interface: 'wlan0',
    start: '192.168.10.100',
    end: '192.168.10.200',
    option: {
        router: '192.168.10.1',
        subnet: '255.255.255.0',
        dns: ['1.1.1.1', '1.0.0.1']
    }
};

enable() {

    ifconfig.up(this.ifConfigOptions, (err: any) => {
        //
    });

    udhcpd.enable(this.dhcpOptions, (err: any) => {
        //
    });

    hostapd.enable(this.options, (err: any) => {
        //
    });
}

}

Compiler Output

`node_modules/@loofkid/wireless-tools/hostapd.d.ts:18:121 - error TS2304: Cannot find name 'TypeOrPromise'.

18 export const disable: <T extends ((err: Error) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, void, import("child_process").ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/hostapd.d.ts:19:117 - error TS2304: Cannot find name 'TypeOrPromise'.

19 export const enable: <T extends ((err: Error) => any) | undefined = undefined>(interface: Options, callback?: T) => TypeOrPromise<T, void, import("child_process").ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/ifconfig.d.ts:31:134 - error TS2304: Cannot find name 'TypeOrPromise'.

31 export const status: <T extends ((err: Error, data: Status) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, Status, void>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/ifconfig.d.ts:32:116 - error TS2304: Cannot find name 'TypeOrPromise'.

32 export const statusAll: <T extends ((err: Error, data: Status[]) => any) | undefined = undefined>(callback?: T) => TypeOrPromise<T, Status[], void>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/ifconfig.d.ts:33:118 - error TS2304: Cannot find name 'TypeOrPromise'.

33 export const down: <T extends ((err: Error) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, void, void>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/ifconfig.d.ts:34:111 - error TS2304: Cannot find name 'TypeOrPromise'.

34 export const up: <T extends ((err: Error) => any) | undefined = undefined>(options: Options, callback?: T) => TypeOrPromise<T, void, void>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/iw.d.ts:22:143 - error TS2304: Cannot find name 'TypeOrPromise'.

22 export const scan: <T extends ((err: Error, networks: Network[]) => any) | undefined = undefined>(options: string | Options, callback?: T) => TypeOrPromise<T, Network[], void>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/iwconfig.d.ts:24:134 - error TS2304: Cannot find name 'TypeOrPromise'.

24 export const status: <T extends ((err: Error, data: Status) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, Status, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/iwconfig.d.ts:25:116 - error TS2304: Cannot find name 'TypeOrPromise'.

25 export const statusAll: <T extends ((err: Error, data: Status[]) => any) | undefined = undefined>(callback?: T) => TypeOrPromise<T, Status[], ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/iwlist.d.ts:24:143 - error TS2304: Cannot find name 'TypeOrPromise'.

24 export const scan: <T extends ((err: Error, networks: Network[]) => any) | undefined = undefined>(options: Options | string, callback?: T) => TypeOrPromise<T, Network[], void>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/udhcpc.d.ts:14:121 - error TS2304: Cannot find name 'TypeOrPromise'.

14 export const disable: <T extends ((err: Error) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, void, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/udhcpc.d.ts:15:115 - error TS2304: Cannot find name 'TypeOrPromise'.

15 export const enable: <T extends ((err: Error) => any) | undefined = undefined>(options: Options, callback?: T) => TypeOrPromise<T, void, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/udhcpd.d.ts:21:115 - error TS2304: Cannot find name 'TypeOrPromise'.

21 export const enable: <T extends ((err: Error) => any) | undefined = undefined>(options: Options, callback?: T) => TypeOrPromise<T, void, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/udhcpd.d.ts:22:121 - error TS2304: Cannot find name 'TypeOrPromise'.

22 export const disable: <T extends ((err: Error) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, void, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:45:136 - error TS2304: Cannot find name 'TypeOrPromise'.

45 export const status: <T extends ((err: Error, status: Status) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, Status, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:46:160 - error TS2304: Cannot find name 'TypeOrPromise'.

46 export const bssid: <T extends ((err: Error, data: unknown) => any) | undefined = undefined>(interfaceName: string, ap: string, ssid: string, callback?: T) => TypeOrPromise<T, unknown, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:47:140 - error TS2304: Cannot find name 'TypeOrPromise'.

47 export const reassociate: <T extends ((err: Error, data: unknown) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, unknown, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:48:165 - error TS2304: Cannot find name 'TypeOrPromise'.

48 export const set: <T extends ((err: Error, data: unknown) => any) | undefined = undefined>(interfaceName: string, variable: string, value: string, callback?: T) => TypeOrPromise<T, unknown, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:49:148 - error TS2304: Cannot find name 'TypeOrPromise'.

49 export const list_networks: <T extends ((err: Error, networks: Network[]) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, Network[], ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:50:140 - error TS2304: Cannot find name 'TypeOrPromise'.

50 export const add_network: <T extends ((err: Error, data: unknown) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, unknown, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:51:185 - error TS2304: Cannot find name 'TypeOrPromise'.

51 export const set_network: <T extends ((err: Error, data: unknown) => any) | undefined = undefined>(interfaceName: string, id: string, variable: string, value: string, callback?: T) => TypeOrPromise<T, unknown, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:52:155 - error TS2304: Cannot find name 'TypeOrPromise'.

52 export const enable_network: <T extends ((err: Error, data: unknown) => any) | undefined = undefined>(interfaceName: string, id: string, callback?: T) => TypeOrPromise<T, unknown, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:53:156 - error TS2304: Cannot find name 'TypeOrPromise'.

53 export const disable_network: <T extends ((err: Error, data: unknown) => any) | undefined = undefined>(interfaceName: string, id: string, callback?: T) => TypeOrPromise<T, unknown, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:54:155 - error TS2304: Cannot find name 'TypeOrPromise'.

54 export const remove_network: <T extends ((err: Error, data: unknown) => any) | undefined = undefined>(interfaceName: string, id: string, callback?: T) => TypeOrPromise<T, unknown, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:55:155 - error TS2304: Cannot find name 'TypeOrPromise'.

55 export const select_network: <T extends ((err: Error, data: unknown) => any) | undefined = undefined>(interfaceName: string, id: string, callback?: T) => TypeOrPromise<T, unknown, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:56:133 - error TS2304: Cannot find name 'TypeOrPromise'.

56 export const scan: <T extends ((err: Error, data: unknown) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, unknown, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:57:141 - error TS2304: Cannot find name 'TypeOrPromise'.

57 export const scan_results: <T extends ((err: Error, data: unknown) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, unknown, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_cli.d.ts:58:140 - error TS2304: Cannot find name 'TypeOrPromise'.

58 export const save_config: <T extends ((err: Error, data: unknown) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, unknown, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_supplicant.d.ts:23:121 - error TS2304: Cannot find name 'TypeOrPromise'.

23 export const disable: <T extends ((err: Error) => any) | undefined = undefined>(interfaceName: string, callback?: T) => TypeOrPromise<T, void, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_supplicant.d.ts:24:121 - error TS2304: Cannot find name 'TypeOrPromise'.

24 export const enable: <T extends ((err: Error) => any) | undefined = undefined>(options: EnableOptions, callback?: T) => TypeOrPromise<T, void, ChildProcess>;
~~~~~~~~~~~~~

node_modules/@loofkid/wireless-tools/wpa_supplicant.d.ts:25:121 - error TS2304: Cannot find name 'TypeOrPromise'.

25 export const manual: <T extends ((err: Error) => any) | undefined = undefined>(options: ManualOptions, callback?: T) => TypeOrPromise<T, void, ChildProcess>;
~~~~~~~~~~~~~

[12:47:26 PM] Found 31 errors. Watching for file changes.

I am glad about your answers!

Many greetings
Malte