rapidjs / rapid.js

An ORM-like Interface and a Router For Your API Requests
https://rapidjs.drewjbartlett.com
710 stars 45 forks source link

Incorrect types for setters in Core #35

Closed mgred closed 6 years ago

mgred commented 6 years ago

The setters of the Core class are wrongly typed in the declaration file index.d.ts

declare class Core {
    debug: void;
    baseURL: void;
    modelName: void;
    routeDelimiter: void;
    caseSensitive: void;
}

Therefore the typescript compiler complains at the following code:

import { Rapid } from 'rapid.js';

class Resource extends Rapid {
        boot() {
                this.modelName = 'my-resource';
        }
}

with the following error:

error TS2322: Type '"my-resource"' is not assignable to type 'void'

According to the defaults.js they simply need to have this types defined:

declare class Core {
    debug: boolean;
    baseURL: string;
    modelName: string;
    routeDelimiter: string;
    caseSensitive: boolean;
}