Skip to content

Number Literal Type support? #7982

Description

TypeScript 1.8.9:
Can there be a way to limit number value for example

an property that accepts 0-255 number or decimals as shown below

eg:

interface options{
red:number[0-255];//0 to 255
count:number[0-*];//0 to infinity
opacity:number[0.0-1.0];// decimal points from 0 to 1
}

this would let users limit the options that most javascript frameworks allow

Thanks

Activity

  1. malibuzios commented on Apr 9, 2016

    @malibuzios

    Here are some related issues: #7480, #4639, #7599, #4895.

  2. mhegazy commented on Apr 11, 2016

    @mhegazy
    Contributor

    See #7480

  3. locked as resolved and limited conversation to collaborators on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedDuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions