proposal-record-tuple icon indicating copy to clipboard operation
proposal-record-tuple copied to clipboard

`Record` name conflict with Typescript

Open stafyniaksacha opened this issue 2 years ago • 1 comments

Since Typescript adoption is quite large, will not the Record name conflict with Record interface?

Knowing about the Type Annotations proposal, it may conflict too?

stafyniaksacha avatar Feb 03 '23 13:02 stafyniaksacha

Some information in https://github.com/tc39/proposal-record-tuple/issues/9 and https://github.com/tc39/proposal-record-tuple/issues/82#issuecomment-1135651745

The conflict is only conceptual rather than breaking. In TypeScript Record exists only as a global symbol in the 'type space', where as the Record constructor in this proposal is a global name in the JavaScript 'value space', so the TypeScript compiler can tell the difference between the two.

Example:

https://www.typescriptlang.org/play?&filetype=ts#code/LAKAJgpgxgNghgJwgAgOYwPYCM42Qb1GWOQBcBPABxSSgwTGQF4CBfAbmQHovlL4oEABYYYkBMgBm9MkJQByWvTDy+CAJYBbdaXUA3FBWpESMCKWQAlaMoBcBEyRIAKDPewAraKQCU9pQzsjk5SCBiaAKIAdqQaEADOzhD2AJKkEAhwWGYAPADaANYQ5PbxsepRqAA0yHq4AK7JyHBR5AC6AHx+yAFgQSBOHKCsoKMgdFFlPcxWNgwAdJJhkTFxiXltPv2gRoYz1nQMOWUalTUnFagd2yCgEAAelPQW+KxAA

acutmore avatar Feb 03 '23 14:02 acutmore