goscript 0.0.49 → 0.0.51

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.
Files changed (65) hide show
  1. package/compiler/analysis.go +1021 -561
  2. package/compiler/analysis_test.go +12 -15
  3. package/compiler/compiler.go +75 -39
  4. package/compiler/decl.go +22 -0
  5. package/compiler/expr-call-async.go +239 -40
  6. package/compiler/expr-call-type-conversion.go +6 -10
  7. package/compiler/expr-call.go +58 -27
  8. package/compiler/sanitize.go +1 -2
  9. package/compiler/spec-struct.go +3 -3
  10. package/compiler/spec-value.go +2 -2
  11. package/compiler/spec.go +66 -43
  12. package/compiler/stmt-assign.go +7 -4
  13. package/compiler/stmt-select.go +52 -1
  14. package/compiler/stmt.go +63 -5
  15. package/compiler/type.go +16 -3
  16. package/dist/gs/builtin/builtin.js.map +1 -1
  17. package/dist/gs/builtin/channel.d.ts +2 -2
  18. package/dist/gs/builtin/channel.js +12 -7
  19. package/dist/gs/builtin/channel.js.map +1 -1
  20. package/dist/gs/context/context.d.ts +16 -18
  21. package/dist/gs/context/context.js +23 -13
  22. package/dist/gs/context/context.js.map +1 -1
  23. package/dist/gs/fmt/fmt.js +3 -1
  24. package/dist/gs/fmt/fmt.js.map +1 -1
  25. package/dist/gs/reflect/type.js +5 -8
  26. package/dist/gs/reflect/type.js.map +1 -1
  27. package/dist/gs/syscall/constants.d.ts +24 -0
  28. package/dist/gs/syscall/constants.js +27 -0
  29. package/dist/gs/syscall/constants.js.map +1 -0
  30. package/dist/gs/syscall/env.d.ts +6 -0
  31. package/dist/gs/syscall/env.js +43 -0
  32. package/dist/gs/syscall/env.js.map +1 -0
  33. package/dist/gs/syscall/errors.d.ts +111 -0
  34. package/dist/gs/syscall/errors.js +547 -0
  35. package/dist/gs/syscall/errors.js.map +1 -0
  36. package/dist/gs/syscall/fs.d.ts +29 -0
  37. package/dist/gs/syscall/fs.js +53 -0
  38. package/dist/gs/syscall/fs.js.map +1 -0
  39. package/dist/gs/syscall/index.d.ts +6 -80
  40. package/dist/gs/syscall/index.js +12 -168
  41. package/dist/gs/syscall/index.js.map +1 -1
  42. package/dist/gs/syscall/rawconn.d.ts +7 -0
  43. package/dist/gs/syscall/rawconn.js +19 -0
  44. package/dist/gs/syscall/rawconn.js.map +1 -0
  45. package/dist/gs/syscall/types.d.ts +12 -0
  46. package/dist/gs/syscall/types.js +2 -0
  47. package/dist/gs/syscall/types.js.map +1 -0
  48. package/dist/gs/time/time.d.ts +2 -1
  49. package/dist/gs/time/time.js +29 -19
  50. package/dist/gs/time/time.js.map +1 -1
  51. package/gs/builtin/builtin.ts +1 -7
  52. package/gs/builtin/channel.ts +18 -12
  53. package/gs/context/context.ts +63 -45
  54. package/gs/fmt/fmt.ts +5 -1
  55. package/gs/reflect/type.ts +5 -10
  56. package/gs/syscall/constants.ts +29 -0
  57. package/gs/syscall/env.ts +47 -0
  58. package/gs/syscall/errors.ts +658 -0
  59. package/gs/syscall/fs.ts +62 -0
  60. package/gs/syscall/index.ts +12 -207
  61. package/gs/syscall/rawconn.ts +23 -0
  62. package/gs/syscall/types.ts +18 -0
  63. package/gs/time/time.ts +35 -21
  64. package/package.json +2 -2
  65. package/gs/TODO.md +0 -129
@@ -1,212 +1,17 @@
1
- import * as $ from '@goscript/builtin/index.js'
1
+ // Re-export all types
2
+ export * from './types.js'
2
3
 
3
- // Essential type aliases
4
- export type uintptr = number
4
+ // Re-export all constants
5
+ export * from './constants.js'
5
6
 
6
- // Errno type for syscall errors
7
- export interface Errno {
8
- Error(): string
9
- Is(target: $.GoError): boolean
10
- Errno(): number
11
- }
7
+ // Re-export environment functions
8
+ export * from './env.js'
12
9
 
13
- // Essential syscall constants
14
- export const O_RDONLY = 0
15
- export const O_WRONLY = 1
16
- export const O_RDWR = 2
17
- export const O_APPEND = 8
18
- export const O_CREATE = 64
19
- export const O_EXCL = 128
20
- export const O_SYNC = 256
21
- export const O_TRUNC = 512
10
+ // Re-export file system structures and functions
11
+ export * from './fs.js'
22
12
 
23
- export const Stdin = 0
24
- export const Stdout = 1
25
- export const Stderr = 2
13
+ // Re-export error constants
14
+ export * from './errors.js'
26
15
 
27
- export const SIGINT = 2
28
- export const SIGTERM = 15
29
-
30
- // File mode constants
31
- export const S_IFMT = 0o170000
32
- export const S_IFREG = 0o100000
33
- export const S_IFDIR = 0o040000
34
- export const S_IFLNK = 0o120000
35
- export const S_IFBLK = 0o060000
36
- export const S_IFCHR = 0o020000
37
- export const S_IFIFO = 0o010000
38
- export const S_IFSOCK = 0o140000
39
- export const S_ISUID = 0o004000
40
- export const S_ISGID = 0o002000
41
- export const S_ISVTX = 0o001000
42
-
43
- // Environment variable functions using Node.js/browser APIs
44
- export function Getenv(key: string): [string, boolean] {
45
- if (typeof process !== 'undefined' && process.env) {
46
- const value = process.env[key]
47
- return value !== undefined ? [value, true] : ['', false]
48
- }
49
- return ['', false]
50
- }
51
-
52
- export function Setenv(key: string, value: string): $.GoError {
53
- if (typeof process !== 'undefined' && process.env) {
54
- process.env[key] = value
55
- return null
56
- }
57
- return { Error: () => 'setenv not supported' }
58
- }
59
-
60
- export function Unsetenv(key: string): $.GoError {
61
- if (typeof process !== 'undefined' && process.env) {
62
- delete process.env[key]
63
- return null
64
- }
65
- return { Error: () => 'unsetenv not supported' }
66
- }
67
-
68
- export function Clearenv(): void {
69
- if (typeof process !== 'undefined' && process.env) {
70
- for (const key in process.env) {
71
- delete process.env[key]
72
- }
73
- }
74
- }
75
-
76
- export function Environ(): $.Slice<string> {
77
- if (typeof process !== 'undefined' && process.env) {
78
- const env: string[] = []
79
- for (const [key, value] of Object.entries(process.env)) {
80
- if (value !== undefined) {
81
- env.push(`${key}=${value}`)
82
- }
83
- }
84
- return $.arrayToSlice(env)
85
- }
86
- return $.arrayToSlice([])
87
- }
88
-
89
- // Dirent structure with Reclen field
90
- export class Dirent {
91
- public Name: $.Bytes = new Uint8Array(0)
92
- public Reclen: number = 0
93
- constructor(init?: any) {
94
- if (init?.Name) this.Name = init.Name
95
- if (init?.Reclen) this.Reclen = init.Reclen
96
- }
97
- }
98
-
99
- // Stat_t structure stub
100
- export class Stat_t {
101
- public Dev: number = 0
102
- public Ino: number = 0
103
- public Mode: number = 0
104
- public Nlink: number = 0
105
- public Uid: number = 0
106
- public Gid: number = 0
107
- public Rdev: number = 0
108
- public Size: number = 0
109
- public Blksize: number = 0
110
- public Blocks: number = 0
111
- public Atime: number = 0
112
- public Mtime: number = 0
113
- public Ctime: number = 0
114
- public AtimeNsec: number = 0
115
- public MtimeNsec: number = 0
116
- public CtimeNsec: number = 0
117
-
118
- constructor(init?: any) {
119
- if (init) {
120
- Object.assign(this, init)
121
- }
122
- }
123
-
124
- public clone(): Stat_t {
125
- return new Stat_t(this)
126
- }
127
- }
128
-
129
- // RawConn interface - stub implementation for JavaScript environment
130
- export interface RawConn {
131
- Control(f: (fd: uintptr) => void): $.GoError
132
- Read(f: (fd: uintptr) => boolean): $.GoError
133
- Write(f: (fd: uintptr) => boolean): $.GoError
134
- }
135
-
136
- // Stub implementation of RawConn that always returns ErrUnimplemented
137
- export class StubRawConn implements RawConn {
138
- Control(_f: (fd: uintptr) => void): $.GoError {
139
- return {
140
- Error: () => 'operation not implemented in JavaScript environment',
141
- }
142
- }
143
-
144
- Read(_f: (fd: uintptr) => boolean): $.GoError {
145
- return {
146
- Error: () => 'operation not implemented in JavaScript environment',
147
- }
148
- }
149
-
150
- Write(_f: (fd: uintptr) => boolean): $.GoError {
151
- return {
152
- Error: () => 'operation not implemented in JavaScript environment',
153
- }
154
- }
155
- }
156
-
157
- // Additional error constants - implement as Errno type
158
- export const ENOSYS: Errno = {
159
- Error: () => 'function not implemented',
160
- Is: (target: $.GoError) => target === ENOSYS,
161
- Errno: () => 38,
162
- }
163
-
164
- export const EISDIR: Errno = {
165
- Error: () => 'is a directory',
166
- Is: (target: $.GoError) => target === EISDIR,
167
- Errno: () => 21,
168
- }
169
-
170
- export const ENOTDIR: Errno = {
171
- Error: () => 'not a directory',
172
- Is: (target: $.GoError) => target === ENOTDIR,
173
- Errno: () => 20,
174
- }
175
-
176
- export const ERANGE: Errno = {
177
- Error: () => 'result too large',
178
- Is: (target: $.GoError) => target === ERANGE,
179
- Errno: () => 34,
180
- }
181
-
182
- export const ENOMEM: Errno = {
183
- Error: () => 'out of memory',
184
- Is: (target: $.GoError) => target === ENOMEM,
185
- Errno: () => 12,
186
- }
187
-
188
- export const ESRCH: Errno = {
189
- Error: () => 'no such process',
190
- Is: (target: $.GoError) => target === ESRCH,
191
- Errno: () => 3,
192
- }
193
-
194
- // Additional missing syscall functions
195
- export function Open(
196
- _path: string,
197
- _flag: number,
198
- _perm: number,
199
- ): [number, $.GoError] {
200
- return [-1, ENOSYS]
201
- }
202
-
203
- export function Sysctl(_name: string): [string, $.GoError] {
204
- return ['', ENOSYS]
205
- }
206
-
207
- // Getpagesize returns the underlying system's memory page size.
208
- export function Getpagesize(): number {
209
- // Return a standard page size for JavaScript environment
210
- // Most systems use 4096 bytes as the default page size
211
- return 4096
212
- }
16
+ // Re-export RawConn implementation
17
+ export * from './rawconn.js'
@@ -0,0 +1,23 @@
1
+ import * as $ from '@goscript/builtin/index.js'
2
+ import { RawConn, uintptr } from './types.js'
3
+
4
+ // Stub implementation of RawConn that always returns ErrUnimplemented
5
+ export class StubRawConn implements RawConn {
6
+ Control(_f: (fd: uintptr) => void): $.GoError {
7
+ return {
8
+ Error: () => 'operation not implemented in JavaScript environment',
9
+ }
10
+ }
11
+
12
+ Read(_f: (fd: uintptr) => boolean): $.GoError {
13
+ return {
14
+ Error: () => 'operation not implemented in JavaScript environment',
15
+ }
16
+ }
17
+
18
+ Write(_f: (fd: uintptr) => boolean): $.GoError {
19
+ return {
20
+ Error: () => 'operation not implemented in JavaScript environment',
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,18 @@
1
+ import * as $ from '@goscript/builtin/index.js'
2
+
3
+ // Essential type aliases
4
+ export type uintptr = number
5
+
6
+ // Errno type for syscall errors
7
+ export interface Errno {
8
+ Error(): string
9
+ Is(target: $.GoError): boolean
10
+ Errno(): number
11
+ }
12
+
13
+ // RawConn interface - stub implementation for JavaScript environment
14
+ export interface RawConn {
15
+ Control(f: (fd: uintptr) => void): $.GoError
16
+ Read(f: (fd: uintptr) => boolean): $.GoError
17
+ Write(f: (fd: uintptr) => boolean): $.GoError
18
+ }
package/gs/time/time.ts CHANGED
@@ -5,21 +5,32 @@ export class Time {
5
5
  private _monotonic?: number // high-resolution monotonic timestamp in nanoseconds
6
6
  private _location: Location // timezone location
7
7
 
8
- constructor(
8
+ constructor(_props?: {}) {
9
+ // Default constructor creates a zero time (Unix epoch in UTC)
10
+ this._date = new globalThis.Date(0)
11
+ this._nsec = 0
12
+ this._monotonic = undefined
13
+ this._location = UTC
14
+ }
15
+
16
+ // create is a static factory method that creates a Time instance with specific parameters
17
+ public static create(
9
18
  date: globalThis.Date,
10
19
  nsec: number = 0,
11
20
  monotonic?: number,
12
21
  location?: Location,
13
- ) {
14
- this._date = new globalThis.Date(date.getTime())
15
- this._nsec = nsec
16
- this._monotonic = monotonic
17
- this._location = location || UTC
22
+ ): Time {
23
+ const time = new Time()
24
+ time._date = new globalThis.Date(date.getTime())
25
+ time._nsec = nsec
26
+ time._monotonic = monotonic
27
+ time._location = location || UTC
28
+ return time
18
29
  }
19
30
 
20
31
  // clone returns a copy of this Time instance
21
32
  public clone(): Time {
22
- return new Time(this._date, this._nsec, this._monotonic, this._location)
33
+ return Time.create(this._date, this._nsec, this._monotonic, this._location)
23
34
  }
24
35
 
25
36
  // Unix returns t as a Unix time, the number of seconds elapsed since January 1, 1970 UTC
@@ -492,7 +503,7 @@ export class Time {
492
503
  const newNsec = this._nsec + (durationNs % 1000000)
493
504
  const newMonotonic =
494
505
  this._monotonic !== undefined ? this._monotonic + durationNs : undefined
495
- return new Time(newDate, newNsec, newMonotonic, this._location)
506
+ return Time.create(newDate, newNsec, newMonotonic, this._location)
496
507
  }
497
508
 
498
509
  // Equal reports whether t and u represent the same time instant
@@ -531,7 +542,7 @@ export class Time {
531
542
  public Round(_d: Duration): Time {
532
543
  // Implementation would round to nearest duration
533
544
  // For now, simplified version that strips monotonic reading
534
- return new Time(this._date, this._nsec, undefined, this._location)
545
+ return Time.create(this._date, this._nsec, undefined, this._location)
535
546
  }
536
547
 
537
548
  // Truncate returns the result of rounding t down to a multiple of d
@@ -539,7 +550,7 @@ export class Time {
539
550
  public Truncate(_d: Duration): Time {
540
551
  // Implementation would truncate to duration
541
552
  // For now, simplified version that strips monotonic reading
542
- return new Time(this._date, this._nsec, undefined, this._location)
553
+ return Time.create(this._date, this._nsec, undefined, this._location)
543
554
  }
544
555
 
545
556
  // String returns the time formatted as a string
@@ -571,8 +582,11 @@ export function Duration_lt(receiver: Duration, other: Duration): boolean {
571
582
  return receiver < other
572
583
  }
573
584
 
574
- // Duration multiplication function
575
- export function Duration_multiply(receiver: Duration, multiplier: number): Duration {
585
+ // Duration multiplication function
586
+ export function Duration_multiply(
587
+ receiver: Duration,
588
+ multiplier: number,
589
+ ): Duration {
576
590
  return receiver * multiplier
577
591
  }
578
592
 
@@ -775,7 +789,7 @@ export function Now(): Time {
775
789
  monotonic = performance.now() * 1000000
776
790
  }
777
791
 
778
- return new Time(date, 0, monotonic)
792
+ return Time.create(date, 0, monotonic)
779
793
  }
780
794
 
781
795
  // Date returns the Time corresponding to
@@ -820,7 +834,7 @@ export function Date(
820
834
  Math.floor(nsec / 1000000),
821
835
  )
822
836
  }
823
- return new Time(date, nsec % 1000000000, undefined, loc) // No monotonic reading
837
+ return Time.create(date, nsec % 1000000000, undefined, loc) // No monotonic reading
824
838
  }
825
839
 
826
840
  // Common locations
@@ -871,13 +885,13 @@ export const Kitchen = '3:04PM'
871
885
  export function Unix(sec: number, nsec: number = 0): Time {
872
886
  const ms = sec * 1000 + Math.floor(nsec / 1000000)
873
887
  const remainingNsec = nsec % 1000000
874
- return new Time(new globalThis.Date(ms), remainingNsec, undefined, UTC)
888
+ return Time.create(new globalThis.Date(ms), remainingNsec, undefined, UTC)
875
889
  }
876
890
 
877
891
  // UnixMilli returns the local Time corresponding to the given Unix time,
878
892
  // msec milliseconds since January 1, 1970 UTC
879
893
  export function UnixMilli(msec: number): Time {
880
- return new Time(new globalThis.Date(msec), 0, undefined, UTC)
894
+ return Time.create(new globalThis.Date(msec), 0, undefined, UTC)
881
895
  }
882
896
 
883
897
  // UnixMicro returns the local Time corresponding to the given Unix time,
@@ -885,7 +899,7 @@ export function UnixMilli(msec: number): Time {
885
899
  export function UnixMicro(usec: number): Time {
886
900
  const ms = Math.floor(usec / 1000)
887
901
  const nsec = (usec % 1000) * 1000
888
- return new Time(new globalThis.Date(ms), nsec, undefined, UTC)
902
+ return Time.create(new globalThis.Date(ms), nsec, undefined, UTC)
889
903
  }
890
904
 
891
905
  // UnixNano returns the local Time corresponding to the given Unix time,
@@ -893,7 +907,7 @@ export function UnixMicro(usec: number): Time {
893
907
  export function UnixNano(nsec: number): Time {
894
908
  const ms = Math.floor(nsec / 1000000)
895
909
  const remainingNsec = nsec % 1000000
896
- return new Time(new globalThis.Date(ms), remainingNsec, undefined, UTC)
910
+ return Time.create(new globalThis.Date(ms), remainingNsec, undefined, UTC)
897
911
  }
898
912
 
899
913
  // ParseDuration parses a duration string
@@ -965,7 +979,7 @@ export function ParseInLocation(
965
979
  `parsing time "${value}" as "${layout}": cannot parse`,
966
980
  )
967
981
  }
968
- return new Time(date, 0, undefined, loc)
982
+ return Time.create(date, 0, undefined, loc)
969
983
  }
970
984
 
971
985
  if (layout === DateTime || layout === '2006-01-02 15:04:05') {
@@ -979,7 +993,7 @@ export function ParseInLocation(
979
993
  `parsing time "${value}" as "${layout}": cannot parse`,
980
994
  )
981
995
  }
982
- return new Time(date, 0, undefined, loc)
996
+ return Time.create(date, 0, undefined, loc)
983
997
  }
984
998
 
985
999
  // Fallback to standard Date parsing
@@ -993,7 +1007,7 @@ export function ParseInLocation(
993
1007
  `parsing time "${value}" as "${layout}": cannot parse`,
994
1008
  )
995
1009
  }
996
- return new Time(date, 0, undefined, loc)
1010
+ return Time.create(date, 0, undefined, loc)
997
1011
  }
998
1012
 
999
1013
  // After waits for the duration to elapse and then returns the current time
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "goscript",
3
3
  "description": "Go to TypeScript transpiler",
4
- "version": "0.0.49",
4
+ "version": "0.0.51",
5
5
  "author": {
6
6
  "name": "Aperture Robotics LLC.",
7
7
  "email": "support@aperture.us",
@@ -61,7 +61,7 @@
61
61
  "release:commit": "git reset && git add package.json && git commit -s -m \"release: v$npm_package_version\" && git tag v$npm_package_version",
62
62
  "release:publish": "git push && git push --tags && npm run build && npm publish",
63
63
  "lint": "npm run lint:go && npm run lint:js",
64
- "lint:go": "make lint",
64
+ "lint:go": "golangci-lint run .",
65
65
  "lint:js": "eslint -c eslint.config.mjs ./",
66
66
  "lint:js:fix": "eslint -c eslint.config.mjs ./ --fix",
67
67
  "prepare": "husky",
package/gs/TODO.md DELETED
@@ -1,129 +0,0 @@
1
- # TODO: Wrapper Type Refactor for gs/ Directory
2
-
3
- ## Overview
4
- The compiler has been refactored to generate wrapper types as type aliases instead of classes, with methods as standalone functions. This requires corresponding updates to the gs/ directory to remove the old class-based implementations and valueOf type parameters.
5
-
6
- ## Required Changes
7
-
8
- ### 1. Remove Wrapper Type Classes
9
- All wrapper type classes in gs/ need to be converted to type aliases with standalone functions:
10
-
11
- **Current pattern (to be removed):**
12
- ```typescript
13
- export class FileMode {
14
- constructor(private _value: number) {}
15
-
16
- valueOf(): number {
17
- return this._value;
18
- }
19
-
20
- String(): string {
21
- return fileModeString(this._value);
22
- }
23
-
24
- IsDir(): boolean {
25
- return (this._value & ModeDir) !== 0;
26
- }
27
- }
28
- ```
29
-
30
- **New pattern (to implement):**
31
- ```typescript
32
- export type FileMode = number;
33
-
34
- export function FileMode_String(receiver: FileMode): string {
35
- return fileModeString(receiver);
36
- }
37
-
38
- export function FileMode_IsDir(receiver: FileMode): boolean {
39
- return (receiver & ModeDir) !== 0;
40
- }
41
- ```
42
-
43
- ### 2. Files that need wrapper type refactoring:
44
- - `gs/os/types_js.gs.ts` - FileMode and other os types
45
- - `gs/time/time.ts` - Duration and other time types
46
- - `gs/syscall/` - Various syscall wrapper types
47
- - Any other files that implement wrapper types as classes
48
-
49
- ### 3. Remove valueOf Type Parameters
50
- The `@builtin` package needs to be updated to remove valueOf type parameters from builtin functions.
51
-
52
- **Current pattern (to be removed):**
53
- ```typescript
54
- function int<T extends { valueOf(): number }>(value: T): number {
55
- return value.valueOf();
56
- }
57
- ```
58
-
59
- **New pattern (to implement):**
60
- ```typescript
61
- function int(value: number): number {
62
- return value;
63
- }
64
- ```
65
-
66
- ### 4. Update Method Call Sites
67
- Any existing method call sites in gs/ files need to be updated:
68
-
69
- **Current pattern (to be updated):**
70
- ```typescript
71
- mode.String() // method call on wrapper class
72
- ```
73
-
74
- **New pattern:**
75
- ```typescript
76
- FileMode_String(mode) // function call with receiver
77
- ```
78
-
79
- ### 5. Remove .valueOf() Calls
80
- The compiler still generates `.valueOf()` calls for wrapper types. These need to be eliminated:
81
-
82
- **Current generated pattern (to be fixed):**
83
- ```typescript
84
- return receiver.valueOf() & 0o111;
85
- ```
86
-
87
- **Target pattern:**
88
- ```typescript
89
- return receiver & 0o111;
90
- ```
91
-
92
- ## Implementation Notes
93
-
94
- ### Analysis Changes Completed
95
- - ✅ Modified analysis to detect wrapper types ahead of time
96
- - ✅ Added receiver mapping for wrapper function identifiers
97
- - ✅ Removed shadowingContext dependency
98
-
99
- ### Compiler Changes Completed
100
- - ✅ Updated `WriteNamedTypeWithMethods()` to generate type aliases
101
- - ✅ Updated method call handling to use function calls
102
- - ✅ Updated type conversion logic for wrapper types
103
- - ✅ Removed constructor generation for wrapper types
104
-
105
- ### Remaining Compiler Issues
106
- - ❌ Stop generating `.valueOf()` calls for wrapper types in:
107
- - `compiler/expr.go` - `needsValueOfForBitwiseOp()` function
108
- - `compiler/expr-call-type-conversion.go` - various conversion functions
109
- - Need to update logic to not add `.valueOf()` for wrapper types since they're now primitive types
110
-
111
- ### Testing
112
- Use the `wrapper_type_args` compliance test to verify changes:
113
- ```bash
114
- go test -timeout 30s -run ^TestCompliance/wrapper_type_args$ ./compiler
115
- ```
116
-
117
- ## Migration Strategy
118
- 1. First complete the compiler changes to stop generating `.valueOf()` calls
119
- 2. Update each gs/ package incrementally
120
- 3. Test each package after refactoring
121
- 4. Update builtin functions to remove valueOf type parameters
122
- 5. Run full test suite to ensure compatibility
123
-
124
- ## Benefits After Completion
125
- - Cleaner generated TypeScript code
126
- - Better performance (no wrapper class overhead)
127
- - More idiomatic TypeScript types
128
- - Simplified runtime type system
129
- - Easier debugging and maintenance