SierraSoftworks / Iridium

A high performance MongoDB ORM for Node.js
http://sierrasoftworks.github.io/Iridium/
Other
570 stars 25 forks source link

Iridium 7.2.5 fails to compile with typescript 2.4.1 #90

Open enbyted opened 7 years ago

enbyted commented 7 years ago

Logs and stuff:

Running tsc (version 2.4.1) gives following error:

node_modules/iridium/dist/lib/cacheControllers/IDDirector.d.ts(8,22): error TS2420: Class 'CacheOnID' incorrectly implements
interface 'CacheDirector'.
  Types of property 'valid' are incompatible.
    Type '(object: { [prop: string]: any; _id: any; }) => boolean' is not assignable to type '<T>(object: T) => boolean'.
      Types of parameters 'object' and 'object' are incompatible.
        Type 'T' is not assignable to type '{ [prop: string]: any; _id: any; }'.
node_modules/iridium/dist/lib/caches/NoOpCache.d.ts(11,22): error TS2420: Class 'NoOpCache' incorrectly implements interface
'Cache'.
  Types of property 'get' are incompatible.
    Type '<T>(key: string) => Bluebird<void>' is not assignable to type '<T>(key: string) => PromiseLike<T>'.
      Type 'Bluebird<void>' is not assignable to type 'PromiseLike<T>'.
        Types of property 'then' are incompatible.
          Type '{ <U>(onFulfill?: (value: void) => U | PromiseLike<U>, onReject?: (error: any) => U | PromiseLike...' is not
assignable to type '<TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, on...'.
            Types of parameters 'onFulfill' and 'onfulfilled' are incompatible.
              Types of parameters 'value' and 'value' are incompatible.
                Type 'void' is not assignable to type 'T'.

Project uses iridium and inversify in latest stable versions.

Node: 6.11.0 Npm: 5.3.0 Typescript: 2.4.1

Additional information:

This doesn't happen with typescipt@2.3.4, so it may as well be upstream. Still it would be better for users to provide a fix here (and report to upstream if it really is an unwanted backeward incompatibility).

notheotherben commented 7 years ago

Hi @enbyted,

Thanks for reporting this, it's the result of the new, stricter, generic checks in TypeScript 2.4 and has been resolved in Iridium's v8.0.0-alpha.2 version (which you can install using npm install --save iridium@next if you're happy to test it).

Please let me know if you encounter any other issues with it and I'll be happy to help out. If this is a production project, my advice is to stick with TypeScript 2.3.x until Iridium 8.x has been thoroughly tested and marked as stable.

Kind regards, Benjamin

enbyted commented 7 years ago

Hi!

Thanks for quick response! Actually this is a new project and it will in few days be running in production (quick facebook bot). But in this case (no direct user input and immunity to crashes) it's okay to run it on alpha. I'll be happy to give it a go.

Regards, Bartosz