node.js - Inaccessible module error in TypeScript declaration file -


c:/node/typescript experiment/node_modules/.bin/tsc.cmd" --sourcemap mongoose.d.ts --module commonjs c:/node/typescript experiment/d.ts/mongoose.d.ts(96,35): error ts2049: parameter 'res' of exported function using inaccessible module  c:/node/typescript experiment/d.ts/mongoose.d.ts(97,54): error ts2049: parameter 'res' of exported function using inaccessible module 

this error, i've included source code well,

///<reference path='definitelytyped/node/node.d.ts' />  export = m;  declare module m {      export interface mongoose {         constructor();         set (key: string, value: string): mongoose;         (key: string): string;         createconnection(uri?: string, options?: any): connection;          connect(any): mongoose;          disconnect(fn: (err?: any) => void ): mongoose;         model(name: string, schema?: schema, collection?: string, skipinit?: boolean): model;         modelnames(): string[];         plugin(fn: (any) => any, opts?: any): mongoose;         mongo: any;         version: string;         connection: connection;     }      export function set(key: string, value: string): mongoose;     export function get(key: string): string;     export function createconnection(uri ? : string, options?: any): connection;      export function connect(any): mongoose;      export function disconnect(fn: (err?: any) => void ): mongoose;     export function model(name: string, schema?: schema, collection?: string, skipinit?: boolean): model;     export function modelnames(): string[];     export function plugin(fn: (any) => any, opts?: any): mongoose;     export var mongo: any;     export var version: string;     export var connection: connection;      export class collection {         name: string;     }      export class connection implements eventemitter {         constructor(base: mongoose);          addlistener(event: string, listener: function);         on(event: string, listener: function);         once(event: string, listener: function): void;         removelistener(event: string, listener: function): void;         removealllisteners(event?: string): void;         setmaxlisteners(n: number): void;         listeners(event: string): { function; }[];         emit(event: string, ...args: any[]): void;          open(connection_string: string,              database?: string,              port?: number,              options?: any,              callback?: (any) => any): connection;          openset(uris: string,                 database?: string,                 options?: any,                 callback?: (any) => any): connection;          close(callback?: (any) => any): connection;         collection(name: string, options?: any): collection;         model(name: string, schema?: schema, collection?: string): model;         modelnames(): string[];         setprofiling(level: number, ms: number, callback: (any) => any): any;         db: any;         collections: any;         readystate: number;     }      export class schema {         constructor(definition: any, options?: any);         static types: {             objectid: any;             mixed: any;         };          methods: any;         statics: any;         path(path: string): any;         virtual(path: string): any;         pre(method: string, callback: (next: (any?) => any) => any): void;     }      export class schematype { }      export class virtualtype { }      export class query<t extends document> {         exec(): promise;         exec(operation: string): promise;         exec(callback: (err: any, res: t[]) => any): promise;         exec(operation: string, callback: (err: any, res: t[]) => void ): promise;          skip(x: number): query;         limit(x: number): query;     }      export class promise { }      export interface model<t extends document> {         new (any): document;          find(conditions: any): query<t>;         find(conditions: any, fields: any): query<t>;         find(conditions: any, fields: any, options: any): query<t>;         find(conditions: any, fields: any, options: any, callback: (err: any, res: any) => void ): query<t>;         find(conditions: any, callback: (err: any, res: t[]) => void ): query<t>;         find(conditions: any, fields: any, callback: (err: any, res: t[]) => void ): query<t>;          findone(conditions: any): query<t>;         findone(conditions: any, fields: any): query<t>;         findone(conditions: any, fields: any, options: any): query<t>;         findone(conditions: any, fields: any, options: any, callback: (err: any, res: t) => void ): query<t>;         findone(conditions: any, callback: (err: any, res: t) => void ): query<t>;         findone(conditions: any, fields: any, callback: (err: any, res: t) => void ): query<t>;          findbyid(id: string): query<t>;         findbyid(id: string, fields: any): query<t>;         findbyid(id: string, fields: any, options: any): query<t>;         findbyid(id: string, fields: any, options: any, callback: (err: any, res: t) => void ): query<t>;         findbyid(id: string, callback: (err: any, res: t) => void ): query<t>;         findbyid(id: string, fields: any, callback: (err: any, res: t) => void ): query<t>;          findbyidandupdate(id: string): query<t>;         findbyidandupdate(id: string, update: any): query<t>;         findbyidandupdate(id: string, update: any, options: any): query<t>;         findbyidandupdate(id: string, update: any, options: any, callback: (err: any, res: t[]) => void ): query<t>;         findbyidandupdate(id: string, callback: (err: any, res: t[]) => void ): query<t>;         findbyidandupdate(id: string, update: any, callback: (err: any, res: t[]) => void ): query<t>;          update(conditions: any,                update: any,                options?: any,                callback?: (err: any, affectedrows: number, raw: any) => void ): query<t>;         update(conditions: any,                update: any,                callback?: (err: any, affectedrows: number, raw: any) => void ): query<t>;          create(doc: any, fn: (err: any, res: t) => void ): void;          collection: collection;          remove(conditions: any, callback?: (err) => void): query<t>;     }     /*      export var model: {      (any);      constructor(doc?: any);      new (any);       find(conditions: any): query;      find(conditions: any, fields: any): query;      find(conditions: any, fields: any, options: any): query;      find(conditions: any, fields: any, options: any, callback: (err: any, res: any) => void ): query;      find(conditions: any, callback: (err: any, res: any) => void ): query;      find(conditions: any, fields: any, callback: (err: any, res: any) => void ): query;       findbyid(id: string): query;      findbyid(id: string, fields: any): query;      findbyid(id: string, fields: any, options: any): query;      findbyid(id: string, fields: any, options: any, callback: (err: any, res: any) => void ): query;      findbyid(id: string, callback: (err: any, res: any) => void ): query;      findbyid(id: string, fields: any, callback: (err: any, res: any) => void ): query;       collection: collection;      }*/      export interface document {         _id: string;         update<t extends document>(doc: any, options: any, callback: (err: any, affectedrows: number, raw: any) => void ): query<t>;         save<t extends document>(fn?: (err: any, res: t) => void ): void;         remove<t extends document>(callback?: (err) => void ): query<t>;     }      export class mongooseerror { }      export class types { }      export class schematypes { } } 

working nodejs 10.3 , typescript 0.9.1. working on trying fix github project here.

this compiler bug introduced in typescript 0.9.1

https://typescript.codeplex.com/workitem/1434

https://typescript.codeplex.com/workitem/1455

it fixed in 0.9.1.1 release branch. can typescript.codeplex.com

or

for time being, can replace

export class query<t extends document> {     exec(): promise;     exec(operation: string): promise;     exec(callback: (err: any, res: t[]) => any): promise;     exec(operation: string, callback: (err: any, res: t[]) => void ): promise;      skip(x: number): query;     limit(x: number): query; } 

with

export interface iexeccallback<t> {     (err: any, res: t[]): any; }  export class query<t extends document> {     exec(): promise;     exec(operation: string): promise;     exec(callback: iexeccallback<t>): promise;     exec(operation: string, callback: iexeccallback<t>): promise;      skip(x: number): query;     limit(x: number): query; } 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -