microsoft / microsoft/TypeScript

Declaration emit differs for negative numeric const literals

Open
#63,831 1 comment 1 reaction 2 assignees Claimed by @jakebailey View on GitHub
Possible Improvement
Dominant language
Go
Stars
111k
Forks
14.3k
PR merge metrics
PR metrics pending

Description

## Steps to reproduce

`main.ts`:
```ts
export const a = -1e500 as const;
export const b = -123456789012345678901234567890 as const;
```

```sh
tsgo --declaration main.ts
```

## Behavior with `typescript@6.0`

```ts
export declare const a: -1e500;
export declare const b: -123456789012345678901234567890;
```

## Behavior with `tsgo`

```ts
export declare const a: -Infinity;
export declare const b: -1.2345678901234568e+29;
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.