5

I have an issue with the webstorm IDE. It seems like that webstorm always shows the error of invalid argument in the IDE, but the typescript compiler do not show such error; I'm starting to believe that this issue is with the IDE.

I have the following repository: https://github.com/danielmahadi/modular-typescript

There are 4 typescript files:

  • customerModel.ts => customer model file

    export class User{
        constructor(public id: string, public name: string){}
    }
    
  • converter.ts => convert json data to customer model

    import model = require('./customerModel')
    
    export function convertToUser(data: any) : model.User {
        return new model.User(data.id, data.name);
    }
    
  • printer.ts => print the customer model to console

    import model = require('./customerModel')
    
    export function print(data : model.User) : void {
        console.log('PRINTING...');
        console.log(data);
    }
    
  • app.js => the entry point for the app.

    import converter = require('./converter');
    import printer = require('./printer');
    
    var d = {
        id: '123', name: 'Test'
    }
    
    var user = converter.convertToUser(d);
    printer.print(user);
    

Environment:

  1. webstorm 7.0.3, build number: WS-133.434
  2. Mac OSX with Maverick
  3. Typescript version: 0.9.5.0

Typescript file watcher setting for typescript:

  • Typescript compiler => tsc --module commonjs --sourcemap $FileName$

If you open this with webstorm IDE, you will see that in the app.ts line 15, the "user" is always underlined with red line with the error "Argument type './customerModel'.User is not assignable to parameter type model.User".

This is what the error looks like:

Has anyone else encountered this before? Am I doing something wrong, or this is just another webstorm bug?

Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
Daniel Mahadi
  • 848
  • 1
  • 10
  • 14

2 Answers2

2

Definitely an error in webstorm. Would appreciate it if you report it here : http://youtrack.jetbrains.com/issues/WEB and put a link so we can vote on it.

basarat
  • 261,912
  • 58
  • 460
  • 511
1

Please try WebStorm 8 EAP - the bug seems to be fixed there

lena
  • 90,154
  • 11
  • 145
  • 150