TypeScript/tests/baselines/reference/recursiveClassReferenceTest.errors.txt

119 lines
3.3 KiB
Plaintext

tests/cases/compiler/recursiveClassReferenceTest.ts(16,19): error TS2304: Cannot find name 'Element'.
tests/cases/compiler/recursiveClassReferenceTest.ts(56,11): error TS2304: Cannot find name 'domNode'.
tests/cases/compiler/recursiveClassReferenceTest.ts(88,36): error TS2304: Cannot find name 'mode'.
tests/cases/compiler/recursiveClassReferenceTest.ts(95,21): error TS2345: Argument of type 'Window' is not assignable to parameter of type 'IMode'.
Property 'getInitialState' is missing in type 'Window'.
==== tests/cases/compiler/recursiveClassReferenceTest.ts (4 errors) ====
// Scenario 1: Test reqursive function call with "this" parameter
// Scenario 2: Test recursive function call with cast and "this" parameter
declare module Sample.Thing {
export interface IWidget {
getDomNode(): any;
destroy();
gar(runner:(widget:Sample.Thing.IWidget)=>any):any;
}
export interface ICodeThing {
getDomNode(): Element;
~~~~~~~
!!! error TS2304: Cannot find name 'Element'.
addWidget(widgetId:string, widget:IWidget);
focus();
//addWidget(widget: Sample.Thing.Widgets.IWidget);
}
export interface IAction {
run(Thing:ICodeThing):boolean;
getId():string;
}
}
module Sample.Actions.Thing.Find {
export class StartFindAction implements Sample.Thing.IAction {
public getId() { return "yo"; }
public run(Thing:Sample.Thing.ICodeThing):boolean {
return true;
}
}
}
module Sample.Thing.Widgets {
export class FindWidget implements Sample.Thing.IWidget {
public gar(runner:(widget:Sample.Thing.IWidget)=>any) { if (true) {return runner(this);}}
private domNode:any = null;
constructor(private codeThing: Sample.Thing.ICodeThing) {
// scenario 1
codeThing.addWidget("addWidget", this);
}
public getDomNode() {
return domNode;
~~~~~~~
!!! error TS2304: Cannot find name 'domNode'.
}
public destroy() {
}
}
}
interface IMode { getInitialState(): IState;}
class AbstractMode implements IMode { public getInitialState(): IState { return null;} }
interface IState {}
interface Window {
opener: Window;
}
declare var self: Window;
module Sample.Thing.Languages.PlainText {
export class State implements IState {
constructor(private mode: IMode) { }
public clone():IState {
return this;
}
public equals(other:IState):boolean {
return this === other;
}
public getMode(): IMode { return mode; }
~~~~
!!! error TS2304: Cannot find name 'mode'.
}
export class Mode extends AbstractMode {
// scenario 2
public getInitialState(): IState {
return new State(self);
~~~~
!!! error TS2345: Argument of type 'Window' is not assignable to parameter of type 'IMode'.
!!! error TS2345: Property 'getInitialState' is missing in type 'Window'.
}
}
}