Were it so easy..
In the basics, we read that Ashen types are immutable, so how is null safety done? how do I.. un-null something?
var nullContent : String? = fsReadText("/banana.txt");
if (nullContent then ctn) {
// ctn is nullContent but of type String, only if nullContent is not null!
}
// If you do not want to manually handle nullables, you can alternative call .force() on any null value to make
// your program crash immediately in case it is null.And there is Ashen's instanceof operator!
var node = parseDocument(....);
if (node instanceof HTMLElement) {
// node is an HTMLElement! cast like this:
var element = node as HTMLElement;
}
// hmm.. thats a lot, but fear no evil! the snippet below does the same thing:
if (node instanceof HTMLElement then element) {
// element is of type HTMLElement!
}