bare-type-stripper 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/strip.h CHANGED
@@ -750,9 +750,13 @@ bare_type_stripper__scan_type(const utf8_t *s, size_t n, size_t i, uint32_t term
750
750
 
751
751
  // Type-level keywords that expect another type to follow. Marking these
752
752
  // as 'op' keeps multi-line conditional types intact (e.g. 'T extends\n
753
- // U ? A : B').
753
+ // U ? A : B'). 'as' covers both a chained cast ('x as unknown as {...}')
754
+ // and a mapped-type key remap ('{ [K in T as U]: V }'), where the type
755
+ // that follows may be an object literal whose '{' must be scanned as an
756
+ // operand rather than mistaken for the caller's terminating brace.
754
757
  last_was_op =
755
- (kl == 2 && memcmp(&s[ks], "is", 2) == 0) ||
758
+ (kl == 2 && (memcmp(&s[ks], "is", 2) == 0 ||
759
+ memcmp(&s[ks], "as", 2) == 0)) ||
756
760
  (kl == 5 && (memcmp(&s[ks], "infer", 5) == 0 ||
757
761
  memcmp(&s[ks], "keyof", 5) == 0)) ||
758
762
  (kl == 6 && memcmp(&s[ks], "typeof", 6) == 0) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-type-stripper",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Heuristic lexer for stripping TypeScript type syntax to produce plain JavaScript",
5
5
  "exports": {
6
6
  "./package": "./package.json",