-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Contextual TypesThe issue relates to contextual typesThe issue relates to contextual types
Milestone
Description
TypeScript Version: 3.3.0-dev.201xxxxx
Search Terms:
Code
export const sp = '_@_';
export interface IWordsOutput
{
_source?: any,
s?: RegExp,
r?: string | IRegExpCallback,
flags?: string,
}
export interface IRegExpCallback
{
($0: string, $1?: string, $2?: string, $3?: string, ...argv): string;
}
export interface IWords extends IWordsOutput
{
[0]: string | RegExp,
[1]: string | IRegExpCallback,
[2]?: string,
}
export const words_source: IWords[] = [
// this is work
['HP', 'HP'],
// Error:TS2739: Type 'string[]' is missing the following properties from type 'IWords': [0], [1]
(function ()
{
let jobclass = '(?:A|B|C)';
return [`${jobclass}${sp}${jobclass}`, '$1・$2'];
})(),
];
Expected behavior:
no error
Actual behavior:
Error:TS2739: Type 'string[]' is missing the following properties from type 'IWords': [0], [1]
Playground Link:
Related Issues:
mnpenner, SirAuron, IhorKlimov, artworkad, yolio2003 and 2 more
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Contextual TypesThe issue relates to contextual typesThe issue relates to contextual types