politie / sherlock

A reactive programming library for JavaScript applications, built with TypeScript.
Apache License 2.0
39 stars 12 forks source link

Typings file incorrectly implemented #20

Closed JoeyHengst closed 6 years ago

JoeyHengst commented 6 years ago

Using sherlock version : "@politie/sherlock": "^1.0.0-beta.1",

With following package.Jon

"dependencies": {
    "@angular/common": "4.3.1",
    "@angular/compiler": "4.3.1",
    "@angular/core": "4.3.1",
    "@angular/forms": "4.3.1",
    "@angular/http": "4.3.1",
    "@angular/platform-browser": "4.3.1",
    "@angular/platform-browser-dynamic": "4.3.1",
    "@angular/router": "4.3.1",
    "@angular/animations": "4.3.1",
    "bootstrap": "4.0.0-alpha.5",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "justid-ng2-generiek": "*",
    "ngx-bootstrap": "^2.0.0-beta.2",
    "rxjs": "5.3.0",
    "ts-helpers": "^1.1.1",
    "moment": "2.18.0",
    "zone.js": "0.8.12"
  },
  "devDependencies": {
    "@angular/cli": "1.2.4",
    "@angular/compiler-cli": "4.3.1",
    "@compodoc/compodoc": "^1.0.1",
    "@politie/sherlock": "^1.0.0-beta.1",
    "@types/jasmine": "2.5.38",
    "@types/node": "6.0.60",
    "babel-preset-es2015": "6.24.1",
    "babel-preset-es2016": "6.22.0",
    "body-parser": "^1.17.1",
    "codelyzer": "3.0.0",
    "concurrently": "^3.3.0",
    "cors": "^2.8.1",
    "express": "^4.14.1",
    "gulp": "^3.9.1",
    "gulp-babel": "6.1.2",
    "gulp-nodemon": "^2.2.1",
    "gulp-sourcemaps": "^2.4.1",
    "gulp-typescript": "^3.1.5",
    "gulp-util": "^3.0.8",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "1.4.1",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-phantomjs-launcher": "^1.0.4",
    "npm-run-all": "^4.1.1",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~5.2.0",
    "typescript": "2.3.2"
  }

`ERROR in C:/git/.../node_modules/@politie/sherlock/derivable/derivable.d.ts
 (5,31): Class 'Derivable<V>' incorrectly implements interface 'TrackedObservabl
e'.
  Property 'observers' is missing in type 'Derivable<V>'.

ERROR in C:/git/.../node_modules/@politie/sherlock/derivable/derivation.d.t
s (27,22): Class 'Derivation<V>' incorrectly implements interface 'TrackedObserv
er'.
  Property 'dependencies' is missing in type 'Derivation<V>'.

ERROR in C:/git/.../node_modules/@politie/sherlock/derivable/lens.d.ts (10,
22): Class 'Lens<V>' incorrectly implements interface 'Atom<V>'.
  Property 'value' is missing in type 'Lens<V>'.`
WouterSpaak commented 6 years ago

This is due to some properties being marked @internal in the implementation of Derivable whereas they're not @internal in the TrackedObservable interface.

I'll look into this but in the mean time you can circumvent this issue by setting "skipLibCheck": true in your tsconfig.json file.

WouterSpaak commented 6 years ago

An easy fix for this is marking observers @internal in src/tracking/tracking.ts:

export interface TrackedObservable extends Observable {
    /** @internal */ // <-- here
    readonly observers: Observer[];
}
pavadeli commented 6 years ago

@WouterSpaak how nice of you to pick a "good first issue" for yourself. 😉