So here it is, the holy grail of allowing classes to have fixed
definitions...

OK what do I mean?

suppose

```
@strict
export class Person{
    name;
}
```

is followed by

```
const person = new Person();
person.age = 27;
```

I would like to see the IDE flag it as " "age" is not a property in strict
class "Person" "

This reminds the developer to then add age as a property, thereby ensuring
every instance of the class always has full autocomplete, quick property
renaming etc. across the project, for all properties added to it. For large
projects with multiple developers this can also have the benefit of
ensuring that all properties added to each instance are necessarily
documented in one place, instead of checking whether someone has
dynamically added a property somewhere.

I would expect this example to throw a runtime exception like @readonly
does. I don't think that's a problem because I think the IDE would inform
much sooner. But I'm open to the idea of the runtime allowing it, since the
real benefit for me is during development. Maybe instead a `@strictDev`
decorator for that behavior, not sure.

Support?
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to