Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

$Immutable<T> of user defined values #267

Open
thecotne opened this issue Jun 2, 2020 · 0 comments
Open

$Immutable<T> of user defined values #267

thecotne opened this issue Jun 2, 2020 · 0 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@thecotne
Copy link
Contributor

thecotne commented Jun 2, 2020

class Cotne {
  name: ?string

  setName(name) {
    this.name = name
  }
}

const cotne = new Cotne

cotne.name = "not cotne"// ok
cotne.setName("not cotne")// ok

const readonly_cotne: $Immutable<Cotne> = new Cotne

readonly_cotne.name = "not cotne"// should error
readonly_cotne.setName("not cotne")// should error

const readonly_cotne2: $Immutable<{ name: string }> = { name: 'cotne' }

readonly_cotne2.name = 'dsds'// should error

try

@JSMonk JSMonk added bug Something isn't working enhancement New feature or request question Further information is requested and removed bug Something isn't working labels Jun 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants