Skip to content

Simplify js check in index constraint errors #15669

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

Merged
merged 3 commits into from
May 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20339,7 +20339,7 @@ namespace ts {
// this allows to rule out cases when both property and indexer are inherited from the base class
let errorNode: Node;
if (propDeclaration &&
(getSpecialPropertyAssignmentKind(propDeclaration as BinaryExpression) === SpecialPropertyAssignmentKind.ThisProperty ||
(propDeclaration.kind === SyntaxKind.BinaryExpression ||
propDeclaration.name.kind === SyntaxKind.ComputedPropertyName ||
prop.parent === containingType.symbol)) {
errorNode = propDeclaration;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
tests/cases/compiler/weird.js(1,1): error TS2304: Cannot find name 'someFunction'.
tests/cases/compiler/weird.js(1,23): error TS7006: Parameter 'BaseClass' implicitly has an 'any' type.
tests/cases/compiler/weird.js(6,13): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/weird.js(9,17): error TS7006: Parameter 'error' implicitly has an 'any' type.


==== tests/cases/compiler/weird.js (4 errors) ====
someFunction(function(BaseClass) {
~~~~~~~~~~~~
!!! error TS2304: Cannot find name 'someFunction'.
~~~~~~~~~
!!! error TS7006: Parameter 'BaseClass' implicitly has an 'any' type.
'use strict';
const DEFAULT_MESSAGE = "nop!";
class Hello extends BaseClass {
constructor() {
super();
~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
this.foo = "bar";
}
_render(error) {
~~~~~
!!! error TS7006: Parameter 'error' implicitly has an 'any' type.
const message = error.message || DEFAULT_MESSAGE;
}
}
});

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
// @Filename: weird.js
// @allowJs: true
// @checkJs: true
// @strict: true
// @noEmit: true
// @out: foo.js
someFunction(function(BaseClass) {
class Hello extends BaseClass {
constructor() {
this.foo = "bar";
}
}
'use strict';
const DEFAULT_MESSAGE = "nop!";
class Hello extends BaseClass {
constructor() {
super();
this.foo = "bar";
}
_render(error) {
const message = error.message || DEFAULT_MESSAGE;
}
}
});