Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F3893838
structured.test.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
structured.test.ts
View Options
import
{
ExtractParsed
}
from
"./component-argument.js"
;
import
{
List
}
from
"./list.js"
;
import
{
ShortText
}
from
"./short-text.js"
;
import
{
Structured
}
from
"./structured.js"
;
describe
(
"structured argument"
,
()
=>
{
it
(
"properly extracts parsed type"
,
()
=>
{
const
args
=
new
Structured
({
value
:
new
ShortText
().
setExampleValues
([
""
]),
tags
:
new
List
(
new
ShortText
()).
setExampleValues
([[
"okazja"
]]),
});
const
values
=
{
value
:
"test"
,
tags
:
[
"tag1"
,
"tag2"
],
}
as
ExtractParsed
<
typeof
args
>
;
values
.
tags
.
map
((
tag
)
=>
tag
.
padStart
(
10
));
// if the types are OK, this will typecheck OK
});
it
(
"properly extracts parsed type within a list"
,
()
=>
{
const
arg
=
new
List
(
new
Structured
({
value
:
new
ShortText
().
setExampleValues
([
""
]),
tags
:
new
List
(
new
ShortText
()).
setExampleValues
([[
"okazja"
]]),
})
);
const
values
=
[
{
value
:
"test"
,
tags
:
[
"tag1"
,
"tag2"
],
},
]
as
ExtractParsed
<
typeof
arg
>
;
values
[
0
].
tags
.
map
((
tag
)
=>
tag
.
padStart
(
10
));
// if the types are OK, this will typecheck OK
});
});
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Mon, May 19, 00:56 (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
629197
Default Alt Text
structured.test.ts (1 KB)
Attached To
Mode
rJDD jdd
Attached
Detach File
Event Timeline
Log In to Comment