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
Hi @branchseer, as the author of ts-blank-space, let me first say that this project is awesome to see! I had hoped that someone would demonstrate an even faster approach that avoided allocating the AST nodes, this wasn't an option for ts-blank-space due to its decision to use TypeScript's official parser API.
One aspect of the 'type-stripping' approach that is perhaps not immediately clear is that it not only preserves the line+column position but it also preserves the full string byte offset. This can be important because the code-coverage data produced by V8 is reported as byte-offsets, not line+column.
This means that when extra characters are added, even if the line+column is either preserved or very close to the original, the byte-offsets will incrementally get further and further away. This is one of the reasons why ts-blank-space doesn't support syntax such as the legacy type assertions <T>{} because it (sometimes) requires adding an extra closing ) after the }.
I wonder if it would make sense to mention this more explicitly in the README?
p.s. I also agree that in the future range mappings may be of big help here.
The text was updated successfully, but these errors were encountered:
Hi @branchseer, as the author of
ts-blank-space
, let me first say that this project is awesome to see! I had hoped that someone would demonstrate an even faster approach that avoided allocating the AST nodes, this wasn't an option forts-blank-space
due to its decision to use TypeScript's official parser API.One aspect of the 'type-stripping' approach that is perhaps not immediately clear is that it not only preserves the line+column position but it also preserves the full string byte offset. This can be important because the code-coverage data produced by V8 is reported as byte-offsets, not line+column.
This means that when extra characters are added, even if the line+column is either preserved or very close to the original, the byte-offsets will incrementally get further and further away. This is one of the reasons why
ts-blank-space
doesn't support syntax such as the legacy type assertions<T>{}
because it (sometimes) requires adding an extra closing)
after the}
.I wonder if it would make sense to mention this more explicitly in the README?
p.s. I also agree that in the future range mappings may be of big help here.
The text was updated successfully, but these errors were encountered: