Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add readonly to TypeScript type modifier #9529

Merged

Conversation

tanhauhau
Copy link
Member

Q                       A
Fixed Issues? Fixes #9503
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

@tanhauhau tanhauhau force-pushed the tanhauhau/parser-typescript-readonly branch from 92ff7c6 to bb9967e Compare February 18, 2019 00:58
@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/10151/

@danez
Copy link
Member

danez commented Feb 18, 2019

Thanks for all the amazing work 👍

@danez danez added PR: Spec Compliance 👓 A type of pull request used for our changelog categories pkg: parser area: typescript labels Feb 18, 2019
@nicolo-ribaudo
Copy link
Member

Maybe we should throw an error for https://github.com/Microsoft/TypeScript/pull/29435/files#diff-e119cc28df9582f9e1ca0d41720ea142R1026?

Unless this is valid, in which case we don't have enough info to know whether to throw or not.

type A = number[];
type B = readonly A;

@danez
Copy link
Member

danez commented Feb 18, 2019

//cc @DanielRosenwasser ^ Above comment

@tanhauhau
Copy link
Member Author

is there a TypeScript Playground that supports readonly?

@nicolo-ribaudo
Copy link
Member

No, it hasn't been released yet.

@existentialism
Copy link
Member

Maybe we should throw an error for Microsoft/TypeScript/pull/29435/files#diff-e119cc28df9582f9e1ca0d41720ea142R1026?

IMO yes, we should

@tanhauhau
Copy link
Member Author

IMO yes, we should

Does that mean we throw a syntax error whenever readonly does not proceed with array literal or tuple literal?

@nicolo-ribaudo
Copy link
Member

It depends on

Unless this is valid, in which case we don't have enough info to know whether to throw or not.

type A = number[];
type B = readonly A;

@nicolo-ribaudo nicolo-ribaudo added this to the v7.5.0 milestone Mar 10, 2019
@nicolo-ribaudo
Copy link
Member

@tanhauhau

Does that mean we throw a syntax error whenever readonly does not proceed with array literal or tuple literal?

Exactly, accordingly to https://github.com/Microsoft/TypeScript/blob/9d3707d671592d030386956c9ce39e539b8d0972/tests/baselines/reference/readonlyArraysAndTuples.errors.txt, we should throw.

@tanhauhau tanhauhau force-pushed the tanhauhau/parser-typescript-readonly branch from bb9967e to ff3a66e Compare March 12, 2019 16:13
@nicolo-ribaudo
Copy link
Member

The circleci failure doesn't seem related to this PR 🤔

@nicolo-ribaudo nicolo-ribaudo added the PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release label Mar 12, 2019
@nicolo-ribaudo nicolo-ribaudo removed the request for review from Jessidhia March 12, 2019 22:27
@nicolo-ribaudo nicolo-ribaudo merged commit cc45608 into babel:master Mar 16, 2019
@nicolo-ribaudo
Copy link
Member

Thanks!

@tanhauhau tanhauhau deleted the tanhauhau/parser-typescript-readonly branch April 18, 2019 00:35
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: typescript outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release PR: Spec Compliance 👓 A type of pull request used for our changelog categories spec-update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript readonly type modifier
5 participants