Skip to content

possible bug: Array<string> | string #13431

@ORESoftware

Description

@ORESoftware

TypeScript Version: 2.1.4

Code

const _ = require('lodash');

export function appendFile($lines: string | Array<string>) : Observable<any> {

    let lines : Array<string> = _.flattenDeep([$lines]);

}

Expected behavior:

This should compile as far as I know.

Actual behavior:

I get this compile error:

lib/queue-proto.ts(84,9): error TS2322: Type '(string | string[])[]' is not assignable to type 'string | string[]'.
  Type '(string | string[])[]' is not assignable to type 'string[]'.
    Type 'string | string[]' is not assignable to type 'string'.
      Type 'string[]' is not assignable to type 'string'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs More InfoThe issue still hasn't been fully clarifiedQuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions