File: uniqueSymbolAllowsIndexInObjectWithIndexSignature.js

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (21 lines) | stat: -rw-r--r-- 656 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//// [uniqueSymbolAllowsIndexInObjectWithIndexSignature.ts]
// https://github.com/Microsoft/TypeScript/issues/21962
export const SYM = Symbol('a unique symbol');

export interface I {
  [SYM]: 'sym';
  [x: string]: 'str';
}

let a: I = {[SYM]: 'sym'}; // Expect ok
let b: I = {[SYM]: 'str'}; // Expect error


//// [uniqueSymbolAllowsIndexInObjectWithIndexSignature.js]
"use strict";
exports.__esModule = true;
var _a, _b;
// https://github.com/Microsoft/TypeScript/issues/21962
exports.SYM = Symbol('a unique symbol');
var a = (_a = {}, _a[exports.SYM] = 'sym', _a); // Expect ok
var b = (_b = {}, _b[exports.SYM] = 'str', _b); // Expect error