2014-07-13 01:04:16 +02:00
|
|
|
/// <reference path="fourslash.ts" />
|
|
|
|
|
|
|
|
////// Simple constraint
|
|
|
|
////class Foo<T extends Object> {
|
|
|
|
//// private v: T;
|
|
|
|
//// public value(): void {
|
|
|
|
//// this.v./*objectMembers*/
|
|
|
|
//// }
|
|
|
|
////}
|
|
|
|
////// Inheritance in constraints
|
|
|
|
////interface IBar1 {
|
|
|
|
//// bar11: number;
|
|
|
|
//// bar12: string;
|
|
|
|
////}
|
|
|
|
////
|
|
|
|
////interface IBar2 extends IBar1 {
|
|
|
|
//// bar21: boolean;
|
|
|
|
//// bar22: IBar2;
|
|
|
|
////}
|
|
|
|
////
|
|
|
|
////class BarWrapper<T extends IBar2> {
|
|
|
|
//// private value: T;
|
|
|
|
//// public getValue(){
|
|
|
|
//// this.value./*interfaceMembers*/;
|
|
|
|
//// }
|
|
|
|
////}
|
|
|
|
////// Interface with call signature
|
|
|
|
////interface ICallable {
|
|
|
|
//// (n: number): string;
|
|
|
|
//// name: string;
|
|
|
|
////}
|
|
|
|
////
|
|
|
|
////class CallableWrapper<T extends ICallable> {
|
|
|
|
//// public call(value: T) {
|
|
|
|
//// value./*callableMembers*/
|
|
|
|
//// }
|
|
|
|
////}
|
|
|
|
////// Only public members of a constraint should be shown
|
|
|
|
////class Base {
|
|
|
|
//// public publicProperty: number;
|
|
|
|
//// private privateProperty: number;
|
|
|
|
//// public publicMethod(): void { }
|
|
|
|
//// private privateMethod(): void { }
|
|
|
|
//// public static publicStaticMethod(): void { }
|
|
|
|
//// private static privateStaticMethod(): void { }
|
|
|
|
////}
|
|
|
|
////
|
|
|
|
////class BaseWrapper<T extends Base> {
|
|
|
|
//// public test(value: T) {
|
|
|
|
//// value./*publicOnlyMemebers*/
|
|
|
|
//// }
|
|
|
|
////}
|
|
|
|
|
|
|
|
goTo.marker("objectMembers");
|
2016-12-07 22:36:11 +01:00
|
|
|
verify.completionListContains("hasOwnProperty");
|
|
|
|
verify.completionListContains("isPrototypeOf");
|
|
|
|
verify.completionListContains("toString");
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
goTo.marker("interfaceMembers");
|
2016-12-07 22:36:11 +01:00
|
|
|
verify.completionListContains("bar11");
|
|
|
|
verify.completionListContains("bar12");
|
|
|
|
verify.completionListContains("bar21");
|
|
|
|
verify.completionListContains("bar22");
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
goTo.marker("callableMembers");
|
2016-12-07 22:36:11 +01:00
|
|
|
verify.completionListContains("name");
|
|
|
|
verify.completionListContains("apply");
|
|
|
|
verify.completionListContains("call");
|
|
|
|
verify.completionListContains("bind");
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
goTo.marker("publicOnlyMemebers");
|
2016-12-07 22:36:11 +01:00
|
|
|
verify.completionListContains("publicProperty");
|
|
|
|
verify.completionListContains("publicMethod");
|
|
|
|
verify.not.completionListContains("privateProperty");
|
|
|
|
verify.not.completionListContains("privateMethod");
|
|
|
|
verify.not.completionListContains("publicStaticMethod");
|
|
|
|
verify.not.completionListContains("privateStaticMethod");
|