npm install -D typescript@npm:@operated/typescriptAnd for VS Code:
- Ctrl/⌘+Shift+P
- Open Settings
- Type in Search "tsdk"
- Put path
./node_modules/typescript/lib/ - Restart VS Code
When operators are run on objects, TypeScript checks whether there is a method to call, instead of an operator. In final JS, it would look like an object method was called. (a + b => a.plus(b))
Along with a compiler, "Go To Definition" feature was supported for IDE: click on an operator between the objects to jump to method, that will be invoked.
* — invDiv is inverted division, needed when divided type is not an object. For example, 2 / vec2(1, 0) will result in vec2(1, 0).invDiv(2)
As another feature, this fork supports referencing properties/methods inside class, which is a usual feature in Java/C#/C++/etc. For example:
class Class {
property1 = 123
method() {
property1++
console.log(property1)
}
}Additionally, you can also add these settings to VS Code to highlight references with implicit this:
"editor.semanticTokenColorCustomizations": {
"enabled": true,
"rules": {
"property.local:typescript": { "foreground": "#9cdcfe" },
"member.local:typescript": { "foreground": "#dcdcaa" }
}
}