镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Empty tuples are allowed in type assertions #9103

Description

TypeScript Version:

master

Code

var a: [] = <[]>[];

Expected behavior:

$ node built/local/tsc.js index.ts
index.ts(1,8): error TS1122: A tuple type element list cannot be empty.
index.ts(1,14): error TS1122: A tuple type element list cannot be empty.

Actual behavior:

$ node built/local/tsc.js index.ts
index.ts(1,8): error TS1122: A tuple type element list cannot be empty.

Activity

  1. DanielRosenwasser commented on Jun 12, 2016

    @DanielRosenwasser
    Member

    Huh! I wonder if people used that as a hack. Thanks for reporting!

  2. DanielRosenwasser commented on Jun 12, 2016

    @DanielRosenwasser
    Member

    As a note, this also works with as-style assertions. Any tests should check for both.

  3. falsandtru commented on Jun 12, 2016

    @falsandtru
    ContributorAuthor

    👍

  4. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions