Comments (4)
Where I can try Ezno? Please add some online sandbox where I can try Ezne online
Currently not public, will be by the summer hopefully when I have more time.
Here is interesting example that makes you think about whole soundness of type checking
Yes this is an interesting issue that is really important for type safety. Under the type rules (which follow TypeScript), it is valid to pass obj
to anotherFunc
. And while this passes under the rules of TypeScript it will throw at runtime as there is no property .length
on null.
Haven't tested but it all the data should be present as Ezno does track mutation effects. I think it would throw a property does not exist on the obj.field.length
line.
from ezno.
Interestingly this is solved in Flow because they do not accept passing a general type to a union type.
I don't like this behaviour and diverges from TS. So effects are the way to go here
from ezno.
This sort of works. Given
const x = { a: 2 }
function updateA(obj: { a: string | number }) {
obj.a = "hi"
}
updateA(x)
const y: number = x.a
It errors with Type "hi" is not assignable to type number
. See specification.md#updating-property
Need to test with arrays and currently doesn't respect if x
has an assingment restriction, so not perfect yet
from ezno.
I think this is now solved with
and
Might come back to make more user friendly and double check all the edge cases are identified at some point, but for now it is at least identified 🎉
from ezno.
Related Issues (20)
- Add more specification tests HOT 2
- Add binary type caching back and think about TypeId HOT 1
- More configuration and per file options/configuration
- Implement destructuring assignment (declaration works already)
- Function .bind. Then .call and .apply
- Record mutated variables / objects that might be mutated by a unknown loop or function call HOT 1
- Check JS Doc / other type annotations HOT 1
- Read from imports HOT 6
- For / while loops
- Expected type during value synthesis HOT 1
- I wonder if this project has matured to this point yet?
- Multiple files as entry point HOT 1
- Exporting type from another file
- Handling explicit file extension (Node16 + NodeNext) HOT 4
- Diagnostics container as a trait / callback
- [feature-request] Is it possible to integrate this into compile time check? HOT 1
- Binary operator checking
- Parse error with comment in object literal HOT 2
- Add an option NOT to bind the value of `this` to a returned value when getting a property to account for destructuring
- Fix and figure out how multiple properties should be represented
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ezno.