Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript 2.5.3 errors when transpiling #105

Closed
Tom-Hudson opened this issue Oct 20, 2017 · 4 comments
Closed

TypeScript 2.5.3 errors when transpiling #105

Tom-Hudson opened this issue Oct 20, 2017 · 4 comments

Comments

@Tom-Hudson
Copy link

@Tom-Hudson Tom-Hudson commented Oct 20, 2017

I updated the version of TypeScript to 2.5.3 in my SerenityJs project and when I attempt to transpile my code, it output the below errors:

image

node_modules/@serenity-js/core/lib/reporting/serenity_bdd_reporter.d.ts(20,22): error TS2420: Class 'SerenityBDDReportExporter' incorrectly implements interface 'ReportExporter<JSONObject>'.
  Types of property 'exportRehearsal' are incompatible.
    Type '(node: RehearsalPeriod) => PromiseLike<FullReport>' is not assignable to type '<F extends JSONObject>(node: RehearsalPeriod) => PromiseLike<F>'.
      Type 'PromiseLike<FullReport>' is not assignable to type 'PromiseLike<F>'.
        Type 'FullReport' is not assignable to type 'F'.
node_modules/@serenity-js/core/lib/screenplay/actor.d.ts(30,22): error TS2420: Class 'Actor' incorrectly implements interface 'UsesAbilities'.
  Types of property 'whoCan' are incompatible.
    Type '(...abilities: Ability[]) => Actor' is not assignable to type '<T extends UsesAbilities>(...abilities: Ability[]) => T'.
      Type 'Actor' is not assignable to type 'T'.
node_modules/serenity-js/lib/serenity-protractor/reporting/protractor_reporter.d.ts(25,22): error TS2420: Class 'ProtractorReportExporter' incorrectly implements interface 'ReportExporter<JSONObject>'.
  Types of property 'exportRehearsal' are incompatible.
    Type '(node: RehearsalPeriod) => PromiseLike<ProtractorReport>' is not assignable to type '<F extends JSONObject>(node: RehearsalPeriod) => PromiseLike<F>'.
      Type 'PromiseLike<ProtractorReport>' is not assignable to type 'PromiseLike<F>'.
        Type 'ProtractorReport' is not assignable to type 'F'.

I am not 100% sure 2.5.3 introduced the issue, i actually believe it would be in v2.4.X, but 2.5.3 is the latest, so when this is looked at it should be fixed to work with that.

Versions
chai: 4.1.2
chai-as-promised: 7.1.1
mocha: 4.0.1
npm-failsafe: 0.2.1
protractor: 5.1.2
serenity-cli: 0.7.0
serenity-js: 1.9.2
ts-node: 3.0.6
tslint: 5.4.3
typescript: 2.5.3

@jan-molak
Copy link
Member

@jan-molak jan-molak commented Oct 20, 2017

Hmm, looks like they must've changed how generics are handled...

@marktigno
Copy link

@marktigno marktigno commented Oct 23, 2017

Agree, lot has been changed since TS 2.5.3. I'm currently using it on my end here but our CI-server still uses TS 2.4.0.

@Tom-Hudson
Copy link
Author

@Tom-Hudson Tom-Hudson commented Oct 23, 2017

@jan-molak - if you add "noStrictGenericChecks": "true", to your tsconfig.json, then you can transpile with 2.5.3!

Here's my tsconfig.json which is working!

{
  "compileOnSave": true,
  "compilerOptions": {
    "target": "es2016",
    "lib": [
      "es2016"
    ],
    "module": "commonjs",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "declaration": false,
    "noStrictGenericChecks": true
  },
  "exclude": [
    "node_modules"
  ]
}

@jan-molak
Copy link
Member

@jan-molak jan-molak commented Oct 24, 2017

Thanks; this could be a good first step towards supporting 2.5.3 generics. I'd love to get to the bottom of the issue, though.

jan-molak added a commit that referenced this issue Jan 21, 2018
…the new TypeScript compiler

affects: @serenity-js/core

Partially addresses #105
@jan-molak jan-molak mentioned this issue Feb 6, 2018
5 tasks
jan-molak added a commit that referenced this issue Jul 29, 2018
affects: @serenity-js/core

In order to enable improvements to various parts of Serenity/JS, I've decided to re-write the core
module.

ISSUES CLOSED: Closes #156, closes #105, partially addresses #162
@jan-molak jan-molak added this to the 2.0 milestone Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants