Skip to content

Commit

Permalink
$mol_view_tree2_to_dts readonly array fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkalica committed Oct 24, 2023
1 parent 982661c commit c5cb501
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions view/tree2/to/dts/dts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ namespace $ {
]

if( input.type[0] === '/' ) return [
input.data('readonly '),
input.data('readonly ('),
input.type.trim().length > 1 ? input.data( input.type.slice(1) ) : input.data('any'),
input.data('[]'),
input.data(')[]'),
]

if( input.type && (input.type.match(/[\+\-]*NaN/) || !Number.isNaN( Number( input.type ) ) ) ) return [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
$mol_view_tree2_to_js_test_ex_array_channel_with_types_foo $mol_view
arr /(readonly(number)[])
arr /readonly(number)[]
5 changes: 3 additions & 2 deletions view/tree2/to/js/test/js.array.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ namespace $ {

'Array channel with types'( $ ) {
const _foo = $mol_view_tree2_to_js_test_ex_array_channel_with_types_foo

$mol_assert_like(_foo.make({ $ }).arr(), [])
const foo = _foo.make({ $ })
type assert_arr = $mol_type_assert<ReturnType<typeof foo['arr']>, readonly( readonly(number)[] )[]>
$mol_assert_like(foo.arr(), [])

},

Expand Down

0 comments on commit c5cb501

Please sign in to comment.