Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Inferred default parameter is erroneous using "typedef" "parameter" #1263

Closed
cfischer opened this issue May 20, 2016 · 1 comment
Closed

Comments

@cfischer
Copy link

cfischer commented May 20, 2016

Bug Report

  • TSLint version: 3.10.2
  • TypeScript version: 1.8.10
  • Running TSLint via: Visual Studio Code

TypeScript code being linted

class C {
  fn(str = '') {
  }
}

or

class C {
  fn(str: string = '') {
  }
}

with tslint.json:

{
  "rules": {
    "typedef": [
      true,
      "parameter"
    ],
    "no-inferrable-types": true
  }
}

Actual behavior

You either get "LHS type (string) inferred by RHS expression, remove type annotation" or "expected parameter: 'str' to have a typedef"

Expected behavior

To not get "expected parameter: 'str' to have a typedef" if you specified a inferable default parameter value.

@cfischer cfischer changed the title Inferred default parameter is always erroneous Inferred default parameter is erroneous using "typedef" "parameter" May 20, 2016
@jkillian
Copy link
Contributor

Yes, this is an issue unfortunately. See #711 and #739

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

No branches or pull requests

2 participants