Skip to content

Commit

Permalink
$mol_view_tree2_to_dts separate d.ts namespace in tests to avoid ts t…
Browse files Browse the repository at this point in the history
…ype merging
  • Loading branch information
zerkalica committed Oct 19, 2023
1 parent e29d3ed commit 691b539
Show file tree
Hide file tree
Showing 40 changed files with 69 additions and 58 deletions.
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/array_channel_boolean.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _array_channel_boolean {

export class Foo extends $mol_object {
bar( ): readonly any[]
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/array_channel_inheritance.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _array_channel_inheritance {

export class Foo extends $mol_object {
arr( ): readonly any[]
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/array_channel_number.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _array_channel_number {

export class Foo extends $mol_object {
bar( ): readonly any[]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _array_channel_of_array_or_object {

export class Foo extends $mol_object {
complex( ): readonly any[]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _array_channel_spread_other_channel {

export class Bar extends $mol_object {
sup( ): readonly any[]
Expand Down
6 changes: 3 additions & 3 deletions view/tree2/to/dts/test/array_channel_with_types.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
declare namespace $ {
declare namespace _array_channel_with_types {

export class Foo extends $mol_object {
arr( ): readonly readonly(number)[]
arr( ): readonly (readonly(number)[])[]
}

}

//# sourceMappingURL=data:application/json,%7B%22version%22%3A3%2C%22sources%22%3A%5B%22%3F%22%5D%2C%22sourcesContent%22%3A%5B%22%5Cn%5Ct%5Ct%5Ct%5CtFoo%20%24mol_object%5Cn%5Ct%5Ct%5Ct%5Ct%5Ctarr%20%2Freadonly(number)%5Cn%5Ct%5Ct%5Ct%22%5D%2C%22mappings%22%3A%22%3B%3BAAAA%3BAAAA%3BAAAA%2CAACI%2CiBAAI%2CoBAAJ%3BAACC%2CAAAA%2CUAAI%3BAADL%3BAADJ%3BAAAA%3B%22%7D
//# sourceMappingURL=data:application/json,%7B%22version%22%3A3%2C%22sources%22%3A%5B%22%3F%22%5D%2C%22sourcesContent%22%3A%5B%22%5Cn%5Ct%5Ct%5Ct%5CtFoo%20%24mol_object%5Cn%5Ct%5Ct%5Ct%5Ct%5Ctarr%20%2F(readonly(number)%5B%5D)%5Cn%5Ct%5Ct%5Ct%22%5D%2C%22mappings%22%3A%22%3B%3BAAAA%3BAAAA%3BAAAA%2CAACI%2CiBAAI%2CoBAAJ%3BAACC%2CAAAA%2CUAAI%3BAADL%3BAADJ%3BAAAA%3B%22%7D
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/bidi_bind_chaining.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _bidi_bind_chaining {

export class Foo extends $mol_object {
a( next?: ReturnType< Foo["b"] > ): ReturnType< Foo["b"] >
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _bidi_bind_doubing_right_part_with_same_default {

export class Foo extends $mol_object {
a( next?: ReturnType< Foo["b"] > ): ReturnType< Foo["b"] >
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/bidi_bind_fallback.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _bidi_bind_fallback {

export class Foo extends $mol_object {
bar1( next?: ReturnType< Foo["bar2"] > ): ReturnType< Foo["bar2"] >
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/bidi_bind_in_dictionary.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _bidi_bind_in_dictionary {

export class Foo extends $mol_object {
event( ): ({
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/bidi_bind_indexed.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _bidi_bind_indexed {

export class Foo extends $mol_object {
indexed( id: any, next?: ReturnType< Foo["owner"] > ): ReturnType< Foo["owner"] >
Expand Down
16 changes: 10 additions & 6 deletions view/tree2/to/dts/test/bidi_bind_indexed_second_level.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
declare namespace $ {
declare namespace _bidi_bind_indexed_second_level {

type $mol_object__expanded_9OBYE6AG = $mol_type_enforce<
export class Bar extends $mol_object {
expanded( ): boolean
}

type Bar__expanded_D1APEXB5 = $mol_type_enforce<
ReturnType< Foo["owner"] >,
ReturnType< $mol_object["expanded"] >
ReturnType< Bar["expanded"] >
>
export class Foo extends $mol_object {
indexed( id: any, next?: $mol_object ): $mol_object
owner( id: any, next?: any ): any
indexed( id: any, next?: Bar ): Bar
owner( id: any, next?: boolean ): boolean
}

}

//# sourceMappingURL=data:application/json,%7B%22version%22%3A3%2C%22sources%22%3A%5B%22%3F%22%5D%2C%22sourcesContent%22%3A%5B%22%5Cn%5Ct%5Ct%5Ct%5CtFoo%20%24mol_object%5Cn%5Ct%5Ct%5Ct%5Ct%5Ctindexed*%3F%20%24mol_object%5Cn%5Ct%5Ct%5Ct%5Ct%5Ct%5Ctexpanded%20%3C%3D%3E%20owner*%3F%20null%5Cn%5Ct%5Ct%5Ct%22%5D%2C%22mappings%22%3A%22%3B%3BAAAA%3BAAAA%3BAAAA%2CAAGM%3BAAAA%2CAAAA%2CEAAS%2CYAFX%2CGAEW%2CEAAI%2CKAAJ%2CIADA%3BAACT%2CEADS%2CyBACT%2CQADS%3BAAAA%3BAADX%2CiBAAI%2CoBAAJ%3BAACC%2CAAAA%2C2BAAU%2CWAAV%2CIAAU%3BAACI%2CAAAA%2CyBAAQ%2CGAAR%2CIAAQ%3BAAFvB%3BAADJ%3BAAAA%3B%22%7D
//# sourceMappingURL=data:application/json,%7B%22version%22%3A3%2C%22sources%22%3A%5B%22%3F%22%5D%2C%22sourcesContent%22%3A%5B%22%5Cn%5Ct%5Ct%5Ct%5CtBar%20%24mol_object%5Cn%5Ct%5Ct%5Ct%5Ct%5Ctexpanded%20false%5Cn%5Ct%5Ct%5Ct%5CtFoo%20%24mol_object%5Cn%5Ct%5Ct%5Ct%5Ct%5Ctindexed*%3F%20Bar%5Cn%5Ct%5Ct%5Ct%5Ct%5Ct%5Ctexpanded%20%3C%3D%3E%20owner*%3F%20false%5Cn%5Ct%5Ct%5Ct%22%5D%2C%22mappings%22%3A%22%3B%3BAAAA%3BAAAA%3BAAAA%2CAACI%2CiBAAI%2CoBAAJ%3BAACC%2CAAAA%2CeAAS%3BAADV%3BAADJ%3BAAKM%3BAAAA%2CAAAA%2CEAAS%2CYAFX%2CGAEW%2CEAAI%2CKAAJ%2CIADA%3BAACT%2CEADS%2CiBACT%2CQADS%3BAAAA%3BAADX%2CiBAAI%2CoBAAJ%3BAACC%2CAAAA%2C2BAAU%2CGAAV%2CIAAU%3BAACI%2CAAAA%2CyBAAQ%2COAAR%2CIAAQ%3BAAFvB%3BAAHJ%3BAAAA%3B%22%7D
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/bidi_bind_legacy_value.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _bidi_bind_legacy_value {

export class Foo extends $mol_object {
a( next?: ReturnType< Foo["b"] > ): ReturnType< Foo["b"] >
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _bidi_bind_localized_default_value {

export class Foo extends $mol_object {
a( next?: ReturnType< Foo["b"] > ): ReturnType< Foo["b"] >
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _bidi_bind_localized_in_object {

export class Foo extends $mol_object {
obj( ): ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _bidi_bind_with_default_object {

export class Foo extends $mol_object {
class( next?: ReturnType< Foo["owner"] > ): ReturnType< Foo["owner"] >
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _bidi_bind_with_separate_default_in_right_part {

export class Foo extends $mol_object {
a( next?: ReturnType< Foo["b"] > ): ReturnType< Foo["b"] >
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/left_bind_chaining.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _left_bind_chaining {

export class Foo extends $mol_object {
a( next?: ReturnType< Foo["b"] > ): ReturnType< Foo["b"] >
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare namespace $ {
declare namespace _left_bind_in_array_and_object {

type $mol_object__rows_R68J75XJ = $mol_type_enforce<
type $mol_object__rows_V83EJ9P9 = $mol_type_enforce<
ReturnType< Foo["content"] >,
ReturnType< $mol_object["rows"] >
>
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/left_bind_read_only.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _left_bind_read_only {

export class Foo extends $mol_object {
bar1( ): ReturnType< Foo["bar2"] >
Expand Down
4 changes: 2 additions & 2 deletions view/tree2/to/dts/test/left_bind_second_level_index.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare namespace $ {
declare namespace _left_bind_second_level_index {

type $mol_object__localized_XB1UI9TS = $mol_type_enforce<
type $mol_object__localized_KDIAWS5L = $mol_type_enforce<
ReturnType< Foo["some"] >,
ReturnType< $mol_object["localized"] >
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare namespace $ {
declare namespace _left_bind_with_separate_default_and_comment {

type $mol_object__rows_0PZB7IMT = $mol_type_enforce<
type $mol_object__rows_L4S07X4S = $mol_type_enforce<
ReturnType< Foo["content"] >,
ReturnType< $mol_object["rows"] >
>
Expand Down
4 changes: 2 additions & 2 deletions view/tree2/to/dts/test/right_bind_in_left_bind.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
declare namespace $ {
declare namespace _right_bind_in_left_bind {

export class Foo extends $mol_object {
a( ): any
}

type Foo__a_EURM0I7U = $mol_type_enforce<
type Foo__a_UIYUO0JW = $mol_type_enforce<
ReturnType< Bar["b"] >,
ReturnType< Foo["a"] >
>
Expand Down
4 changes: 2 additions & 2 deletions view/tree2/to/dts/test/right_bind_indexed.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _right_bind_indexed {

export class Foo extends $mol_object {
a( next?: ({
Expand All @@ -8,7 +8,7 @@ declare namespace $ {
})
}

type Foo__a_YR1ZROQX = $mol_type_enforce<
type Foo__a_QYLYNT1E = $mol_type_enforce<
ReturnType< Bar["b"] >,
ReturnType< Foo["a"] >
>
Expand Down
4 changes: 2 additions & 2 deletions view/tree2/to/dts/test/right_bind_read_only.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
declare namespace $ {
declare namespace _right_bind_read_only {

export class Foo extends $mol_object {
a( id: any, next?: any ): any
}

type Foo__a_SJ1R2SRB = $mol_type_enforce<
type Foo__a_2HF0Z2KM = $mol_type_enforce<
ReturnType< Bar["b"] >,
ReturnType< Foo["a"] >
>
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/simple_commented_node.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _simple_commented_node {

export class A2 extends $mol_object {
str( ): string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _simple_default_indexed_channel {

export class Foo extends $mol_object {
a( id: any, next?: any ): any
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/simple_empty_class.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _simple_empty_class {

export class Foo extends $mol_object {
}
Expand Down
8 changes: 4 additions & 4 deletions view/tree2/to/dts/test/simple_factory_props.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
declare namespace $ {
declare namespace _simple_factory_props {

type $mol_object__some_MEU8ZDON = $mol_type_enforce<
type $mol_object__some_ODAWC5JF = $mol_type_enforce<
boolean,
ReturnType< $mol_object["some"] >
>
type $mol_object__loc_QAO95716 = $mol_type_enforce<
type $mol_object__loc_UDO07ACF = $mol_type_enforce<
string,
ReturnType< $mol_object["loc"] >
>
type $mol_object__sub_E04KCN5P = $mol_type_enforce<
type $mol_object__sub_XVYAJKRH = $mol_type_enforce<
readonly any[],
ReturnType< $mol_object["sub"] >
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _simple_mutable_and_read_only_channels {

export class Foo extends $mol_object {
readonly( ): any
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/simple_string_channel.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _simple_string_channel {

export class Foo extends $mol_object {
hardcoded( ): string
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/simple_two_classes.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _simple_two_classes {

export class A2 extends $mol_object {
str( ): string
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/dts/test/structural_channel.test.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _structural_channel {

export class Foo extends $mol_object {
bar( ): ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _structural_channel_localized_prop_value {

export class Foo extends $mol_object {
bar( ): ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _structural_channel_quoted_props {

export class Foo extends $mol_object {
bar( ): ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _structural_channel_spread_other_channel {

export class Bar extends $mol_object {
test( ): ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare namespace $ {
declare namespace _structural_channel_with_inheritance {

export class Foo extends $mol_object {
field( ): ({
Expand Down
2 changes: 1 addition & 1 deletion view/tree2/to/js/js.array.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace $ {
'Array channel with types'( $ ) {
const { Foo } = run(`
Foo $mol_object
arr /readonly(number)
arr /(readonly(number)[])
`)

$mol_assert_like(Foo.make({ $ }).arr(), [])
Expand Down
10 changes: 7 additions & 3 deletions view/tree2/to/js/js.bidi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,15 @@ namespace $ {
},

'Bidi bind indexed second level'( $ ) {
const { Foo } = run(`
const { Foo, Bar } = run(`
Bar $mol_object
expanded false
Foo $mol_object
indexed*? $mol_object
expanded <=> owner*? null
indexed*? Bar
expanded <=> owner*? false
`)
Foo.$.Bar = Bar

const foo = Foo.make({ $ })


Expand Down
5 changes: 4 additions & 1 deletion view/tree2/to/js/test/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ namespace $ {
?.split('\n').at(2)?.match(/ at (.*) \(/)
?.[1].toLowerCase().replace(/[ .]/g, '_') ?? ''

$mol_view_tree2_to_js_test_saver(`mol/view/tree2/to/dts/test/${name}.test.d.ts`, types)
$mol_view_tree2_to_js_test_saver(
`mol/view/tree2/to/dts/test/${name}.test.d.ts`,
types.replace(/^(declare namespace )\$/, `$1_${name}`)
)

eval( js )

Expand Down

0 comments on commit 691b539

Please sign in to comment.