Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F3010624
component-argument.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
component-argument.ts
View Options
import
{
JDDContext
}
from
"../index"
;
import
{
Structured
}
from
"./structured"
;
export
type
ExtractComponentArgumentValue
<
C
>
=
C
extends
ComponentArgument
<
infer
T
>
?
T
:
never
;
export
type
ExtractStructuredComponentArgumentsValues
<
C
>
=
{
[
property
in
keyof
C
]
:
ExtractComponentArgumentValue
<
C
[
property
]
>
;
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export
type
T
=
ExtractComponentArgumentValue
<
Structured
<
any
>>
;
export
abstract
class
ComponentArgument
<
ARG
>
{
public
example_values
:
ARG
[]
=
[];
public
parent_argument
:
ComponentArgument
<
unknown
>
|
null
=
null
;
abstract
getTypeName
()
:
string
;
abstract
getEmptyValue
()
:
ARG
;
abstract
countWords
(
value
:
ARG
)
:
number
;
getExampleValue
(
_context
:
JDDContext
)
:
Promise
<
ARG
>
|
ARG
{
return
this
.
example_values
[
Math
.
floor
(
this
.
example_values
.
length
*
Math
.
random
())
];
}
setExampleValues
(
values
:
ARG
[])
:
this
{
this
.
example_values
=
values
;
return
this
;
}
hasParent
(
type
:
string
)
{
let
parent
=
this
.
parent_argument
;
while
(
parent
)
{
if
(
parent
.
getTypeName
()
==
type
)
{
return
true
;
}
parent
=
parent
.
parent_argument
;
}
return
false
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Wed, May 7, 19:45 (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
667033
Default Alt Text
component-argument.ts (1 KB)
Attached To
Mode
rJDD jdd
Attached
Detach File
Event Timeline
Log In to Comment