micaww / rage-rpc

A universal, asynchronous RPC implementation for RAGE Multiplayer
33 stars 20 forks source link

A parameter initializer is only allowed in a function or constructor implementation. #8

Closed riffy closed 4 years ago

riffy commented 5 years ago

During build of typescript (npx tsc --pretty) the following errors occur:

node_modules/rage-rpc/dist/rage-rpc.d.ts:5:57 - error TS2371: A parameter initializer is only allowed in a function or constructor implementation.

export function call<T = any>(name: string, args?: any, options: CallOptions = {}): Promise<T>;
                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/rage-rpc/dist/rage-rpc.d.ts:6:63 - error TS2371: A parameter initializer is only allowed in a function or constructor implementation.

export function callServer<T = any>(name: string, args?: any, options: CallOptions = {}): Promise<T>;
                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/rage-rpc/dist/rage-rpc.d.ts:7:79 - error TS2371: A parameter initializer is only allowed in a function or constructor implementation.

export function callClient<T = any>(player: Player, name: string, args?: any, options: CallOptions = {}): Promise<T>;
                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/rage-rpc/dist/rage-rpc.d.ts:8:63 - error TS2371: A parameter initializer is only allowed in a function or constructor implementation.

export function callClient<T = any>(name: string, args?: any, options: CallOptions = {}): Promise<T>;
                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/rage-rpc/dist/rage-rpc.d.ts:9:81 - error TS2371: A parameter initializer is only allowed in a function or constructor implementation.

export function callBrowsers<T = any>(player: Player, name: string, args?: any, options: CallOptions = {}): Promise<T>;
                                                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/rage-rpc/dist/rage-rpc.d.ts:10:65 - error TS2371: A parameter initializer is only allowed in a function or constructor implementation.

export function callBrowsers<T = any>(name: string, args?: any, options: CallOptions = {}): Promise<T>;
                                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/rage-rpc/dist/rage-rpc.d.ts:11:82 - error TS2371: A parameter initializer is only allowed in a function or constructor implementation.

export function callBrowser<T = any>(browser: Browser, name: string, args?: any, options: CallOptions = {}): Promise<T>;

If the initializer ={} is omitted from the CallOptions, a warning is passed: A required parameter cannot follow an optional parameter. due to args? being appended before.

Maybe its something to ignore or seomthing that my settings are causing, since the export is a function? Any advice is appreciated :)

micaww commented 5 years ago

Hey there! I'll look into this. I thought a default initializer meant to Typescript that the parameter is optional.

micaww commented 4 years ago

Fixed by PR #10