You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The benefit of this approach is that it introduces no runtime overhead. It is not perfect however, as it requires casts and can lose the type annotations:
consta=1asoneIndexedNumber;constb=1asoneIndexedNumber;constc=a+b;// type is number
@mhegazy @andy-ms Is a better way to do this with TS? It would be super useful for large codebases like ours
The text was updated successfully, but these errors were encountered:
Problem
The VS Code codebase has some indexes that start at one (
IRange
) and some that start at zero. I am very stupid and will not remember thisProposal
Use types to annotate which types are one indexed:
Based on microsoft/TypeScript#364, the type could be something like:
The benefit of this approach is that it introduces no runtime overhead. It is not perfect however, as it requires casts and can lose the type annotations:
@mhegazy @andy-ms Is a better way to do this with TS? It would be super useful for large codebases like ours
The text was updated successfully, but these errors were encountered: