mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Simplified JS prototype class inference
This commit is contained in:
@@ -22,8 +22,8 @@
|
||||
// Members of the class instance
|
||||
goTo.marker('1');
|
||||
edit.insert('.');
|
||||
verify.memberListContains('foo', undefined, undefined, 'method');
|
||||
verify.memberListContains('bar', undefined, undefined, 'method');
|
||||
verify.memberListContains('foo', undefined, undefined, 'property');
|
||||
verify.memberListContains('bar', undefined, undefined, 'property');
|
||||
edit.backspace();
|
||||
|
||||
// Members of a class method (1)
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// ES6 classes can extend from JS classes
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: myMod.js
|
||||
//// function myCtor(x) {
|
||||
//// this.qua = 10;
|
||||
//// }
|
||||
//// myCtor.prototype.foo = function() { return 32 };
|
||||
//// myCtor.prototype.bar = function() { return '' };
|
||||
////
|
||||
//// class MyClass extends myCtor {
|
||||
//// fn() {
|
||||
//// this/*1*/
|
||||
//// let y = super.foo();
|
||||
//// y;
|
||||
//// }
|
||||
//// }
|
||||
//// var n = new MyClass(3);
|
||||
//// n/*2*/;
|
||||
|
||||
goTo.marker('1');
|
||||
edit.insert('.');
|
||||
// Current class method
|
||||
verify.completionListContains('fn', undefined, undefined, 'method');
|
||||
// Base class method
|
||||
verify.completionListContains('foo', undefined, undefined, 'method');
|
||||
// Base class instance property
|
||||
verify.completionListContains('qua', undefined, undefined, 'property');
|
||||
edit.backspace();
|
||||
|
||||
// Derived class instance from outside the class
|
||||
goTo.marker('2');
|
||||
edit.insert('.');
|
||||
verify.completionListContains('fn', undefined, undefined, 'method');
|
||||
// Base class method
|
||||
verify.completionListContains('foo', undefined, undefined, 'method');
|
||||
// Base class instance property
|
||||
verify.completionListContains('qua', undefined, undefined, 'property');
|
||||
@@ -16,15 +16,6 @@ goTo.marker('1');
|
||||
edit.insert('.');
|
||||
|
||||
// Check members of the function
|
||||
verify.completionListContains('prototype', undefined, undefined, 'property');
|
||||
verify.completionListContains('foo', undefined, undefined, 'warning');
|
||||
verify.completionListContains('bar', undefined, undefined, 'warning');
|
||||
verify.completionListContains('qua', undefined, undefined, 'warning');
|
||||
|
||||
// Check members of function.prototype
|
||||
edit.insert('prototype.');
|
||||
verify.completionListContains('foo', undefined, undefined, 'method');
|
||||
verify.completionListContains('bar', undefined, undefined, 'method');
|
||||
verify.completionListContains('qua', undefined, undefined, 'warning');
|
||||
verify.completionListContains('prototype', undefined, undefined, 'warning');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user