mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
48 lines
2.2 KiB
Plaintext
48 lines
2.2 KiB
Plaintext
arrayAssignmentTest5.ts(21,66): error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
|
|
arrayAssignmentTest5.ts(23,17): error TS2322: Type 'IToken[]' is not assignable to type 'IStateToken[]'.
|
|
Property 'state' is missing in type 'IToken' but required in type 'IStateToken'.
|
|
arrayAssignmentTest5.ts(29,13): error TS2322: Type 'null' is not assignable to type 'ILineTokens'.
|
|
|
|
|
|
==== arrayAssignmentTest5.ts (3 errors) ====
|
|
namespace Test {
|
|
interface IState {
|
|
}
|
|
interface IToken {
|
|
startIndex: number;
|
|
}
|
|
interface IStateToken extends IToken {
|
|
state: IState;
|
|
}
|
|
interface ILineTokens {
|
|
tokens: IToken[];
|
|
endState: IState;
|
|
}
|
|
interface IAction {
|
|
}
|
|
interface IMode {
|
|
onEnter(line:string, state:IState, offset:number):IAction;
|
|
tokenize(line:string, state:IState, includeStates:boolean):ILineTokens;
|
|
}
|
|
export class Bug implements IMode {
|
|
public onEnter(line:string, state:IState, offset:number):IAction {
|
|
~~~~~~~
|
|
!!! error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
|
|
var lineTokens:ILineTokens= this.tokenize(line, state, true);
|
|
var tokens:IStateToken[]= lineTokens.tokens;
|
|
~~~~~~
|
|
!!! error TS2322: Type 'IToken[]' is not assignable to type 'IStateToken[]'.
|
|
!!! error TS2322: Property 'state' is missing in type 'IToken' but required in type 'IStateToken'.
|
|
!!! related TS2728 arrayAssignmentTest5.ts:8:9: 'state' is declared here.
|
|
if (tokens.length === 0) {
|
|
return this.onEnter(line, tokens, offset); // <== this should produce an error since onEnter can not be called with (string, IStateToken[], offset)
|
|
}
|
|
}
|
|
public tokenize(line:string, state:IState, includeStates:boolean):ILineTokens {
|
|
return null;
|
|
~~~~~~
|
|
!!! error TS2322: Type 'null' is not assignable to type 'ILineTokens'.
|
|
}
|
|
}
|
|
}
|
|
|