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

Commit

Permalink
[no-inferred-empty-object-type] Skip test in TS > 3.4.x (#4661)
Browse files Browse the repository at this point in the history
As the generic parameters are inferred as `unknown` in newer TS versions (> 3.4.x), this rule no longer applies in those versions, and those places that would have previously thrown an error, as seen in the tests, no longer should throw as they are no longer inferred as `{}`.
  • Loading branch information
ericbf authored and adidahiya committed Apr 16, 2019
1 parent 2ca2f19 commit 5272262
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rules/noInferredEmptyObjectTypeRule.ts
Expand Up @@ -30,8 +30,9 @@ export class Rule extends Lint.Rules.TypedRule {
options: null,
optionExamples: [true],
rationale: Lint.Utils.dedent`
When function or constructor may be called with a type parameter but one isn't supplied or inferrable,
TypeScript defaults to \`{}\`.
Prior to TypeScript 3.4, generic type parameters for functions and constructors are inferred as
\`{}\` (the empty object type) by default when no type parameter is explicitly supplied or when
the compiler cannot infer a more specific type.
This is often undesirable as the call is meant to be of a more specific type.
`,
type: "functionality",
Expand Down
1 change: 1 addition & 0 deletions test/rules/no-inferred-empty-object-type/test.ts.lint
@@ -1,3 +1,4 @@
[typescript]: <=3.4.x
let s: string;
let n: number;
let o: Object;
Expand Down

0 comments on commit 5272262

Please sign in to comment.