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

TS2339 error mismatch between tss and tsc #58

Closed
dvogel opened this issue Jun 5, 2015 · 2 comments
Closed

TS2339 error mismatch between tss and tsc #58

dvogel opened this issue Jun 5, 2015 · 2 comments

Comments

@dvogel
Copy link

dvogel commented Jun 5, 2015

Given this file:

['a', 'b', 'c'].find(function(letter, idx, ary){
  return letter == 'c';
});

I can run it through tsc 1.5.0-beta without any errors.

However, when using typescript-tools sha 619d879 I see an error when I run the file through tss:

echo showErrors | tss array_of_string_find_method.ts | jq '.'
"loaded /tmp/array_of_string_find_method.ts, TSS listening.."
[
  {
    "file": "/tmp/array_of_string_find_method.ts",
    "start": {
      "line": 1,
      "character": 17
    },
    "end": {
      "line": 1,
      "character": 21
    },
    "text": "Property 'find' does not exist on type 'string[]'.",
    "code": 2339,
    "phase": "Semantics",
    "category": "Error"
  }
]
@clausreinke
Copy link
Owner

I can run it through tsc 1.5.0-beta without any errors.

I doubt that!-) tsc tends to generate code even in the presence of non-fatal errors, but it does emit the error you mentioned. find is an ES6/2015 method, and tsc/tss default to target ES5, so there has to be an error. Adding --target es6 eliminates the error in both cases.

@dvogel
Copy link
Author

dvogel commented Jun 5, 2015

My mistake. I didn't realize that adding filenames to the tss command line overrode the default behavior of loading the tsconfig.json file. I used the --target ES6 parameter on the command line when testing tsc. At that point I had not yet read this on the typescript wiki:

When input files are specified on the command line, tsconfig.json files are ignored.

Thanks for your explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants