-1

I'm a little bit frustrated because i can't find and solve my issue.

I get an error from the webpack ts compiler - awesome-typescript-loader.

This is the error i get:

ERROR in [at-loader] ./src/content.ts:12:2 
TS2554: Expected 3 arguments, but got 2.

And this is my content.ts:

interface Window {
    InjectFeelter: IInjectFeelter
}

interface IInjectFeelter {
    PlaceApp: () => void;
}

class InjectFeelter implements IInjectFeelter {
    PlaceApp() {
        console.log('test')
    } ///// line 12
}

window.InjectFeelter = new InjectFeelter();

If i remove the PlaceApp method the error disappears, it's about the method not what inside of it.

What is the problem here?

adir kandel
  • 725
  • 7
  • 9
  • 6
    One, two, three, four...wait, did I already count that line? Blast. Okay. One, two, three, four, five, six, seven... Oh, darn it! Lost my place again. Right. One, two... (E.g.: Throw us a bone and **point to line 12**.) – T.J. Crowder Feb 12 '18 at 16:32
  • 1
    If line 12 is the line I think it is, I can't see why it would be expecting three arguments. I'd check the project config. – T.J. Crowder Feb 12 '18 at 16:32
  • 1
    And trust the compiler - usually they do not lie - when they say "Expected 3 arguments, but got 2" - you are shortchanging by not passing an arg – Ari Singh Feb 12 '18 at 16:33
  • You should definetly use a cool IDE, e.g. http://atom.io with its tslint plugin to show such errors inline and solve them while coding. Thats the real benefit of typescript over js. – Jonas Wilms Feb 12 '18 at 16:35
  • 1
    @T.J. Crowder - thanks for the comment, i marked the line – adir kandel Feb 12 '18 at 16:57
  • shouldn't $('body *').hover(e => {}) be $('body *').hover( (e) => {}) ? – digital-pollution Feb 12 '18 at 16:59
  • @digital-pollution: The parens are optional when there's exactly one formal parameter for the arrow. – T.J. Crowder Feb 12 '18 at 17:12
  • @T.J.Crowder ah yes you are right removed the answer. – digital-pollution Feb 12 '18 at 17:17

1 Answers1

0

I found the answer, the problem was the order of my rules inside my webpack config file

rules: [
    {
        test: /\.tsx?$/, // files ending with .ts
        loader: 'awesome-typescript-loader'
    },
    {
        test: /\.jsx?|\.tsx?/, // files ending with .jsx
        exclude: /(node_modules|bower_components)/,
        loader: 'babel-loader',
        query: {
            presets: ['es2015', 'react']
        }
    }
]

I just switched their order and it solve the error.

adir kandel
  • 725
  • 7
  • 9