@kipper/target-ts
Table of contents
Classes
- KipperTypeScriptTarget
- TypeScriptTargetBuiltInGenerator
- TypeScriptTargetCodeGenerator
- TypeScriptTargetSemanticAnalyser
Variables
Functions
- createTSFunctionSignature
- createTSGenericFunctionSignature
- genTSFunction
- genTSGenericFunction
- genTSVariable
- getTSFunctionSignature
Variables
TargetTS
• Const
TargetTS: typeof KipperTypeScriptTarget
= KipperTypeScriptTarget
The TypeScript translation target for the Kipper language.
Alias for KipperTypeScriptTarget.
Since
0.10.0
Defined in
kipper/target-ts/src/target.ts:108
author
• Const
author: "Luna Klatzer"
Defined in
kipper/target-ts/src/index.ts:18
github
• Const
github: "https://github.com/Kipper-Lang/Kipper"
Defined in
kipper/target-ts/src/index.ts:22
license
• Const
license: "GPL-3.0-or-later"
Defined in
kipper/target-ts/src/index.ts:20
name
• Const
name: "\@kipper/target-ts"
Defined in
kipper/target-ts/src/index.ts:14
version
• Const
version: "0.12.0"
Defined in
kipper/target-ts/src/index.ts:16
Functions
createTSFunctionSignature
▸ createTSFunctionSignature(signature
, ignoreParams?
): string
Generates the TypeScript function signature, based on the signature metadata.
Since
0.10.0
Parameters
Name | Type | Default value | Description |
---|---|---|---|
signature |
Object |
undefined |
The function signature metadata. |
signature.identifier |
string |
undefined |
- |
signature.params |
{ identifier : string ; type : ProcessedType }[] |
undefined |
- |
signature.returnType |
ProcessedType |
undefined |
- |
ignoreParams |
boolean |
false |
Whether or not to ignore the parameters of the function. |
Returns
string
Defined in
kipper/target-ts/src/tools.ts:59
createTSGenericFunctionSignature
▸ createTSGenericFunctionSignature(signature
, ignoreParams?
): string
Parameters
Name | Type | Default value |
---|---|---|
signature |
Object |
undefined |
signature.identifier |
string |
undefined |
signature.params |
{ identifier : string ; type : any }[] |
undefined |
signature.returnType |
any |
undefined |
ignoreParams |
boolean |
false |
Returns
string
Defined in
kipper/target-ts/src/tools.ts:75
genTSFunction
▸ genTSFunction(signature
, body
, ignoreParams?
): TranslatedCodeLine
[]
Generates a TypeScript function from the given signature and body.
Since
0.10.0
Parameters
Name | Type | Default value | Description |
---|---|---|---|
signature |
Object |
undefined |
The signature of the function. |
signature.identifier |
string |
undefined |
- |
signature.params |
{ identifier : string ; type : ProcessedType }[] |
undefined |
- |
signature.returnType |
ProcessedType |
undefined |
- |
body |
string |
undefined |
The body of the function. |
ignoreParams |
boolean |
false |
Whether or not to ignore the parameters of the function. |
Returns
TranslatedCodeLine
[]
Defined in
kipper/target-ts/src/built-in-generator.ts:25
genTSGenericFunction
▸ genTSGenericFunction(signature
, body
, ignoreParams?
): TranslatedCodeLine
[]
Generates a TypeScript generic function from the given signature and body.
This allows for the use of 'T' as a generic type in the function. This is just a very primitive function which is used to avoid TS errors when using type unions or similar. Will probably be improved in the future as the type system gets more complex.
Since
0.12.0
Parameters
Name | Type | Default value | Description |
---|---|---|---|
signature |
Object |
undefined |
The signature of the function. |
signature.identifier |
string |
undefined |
- |
signature.params |
{ identifier : string ; type : any }[] |
undefined |
- |
signature.returnType |
any |
undefined |
- |
body |
string |
undefined |
The body of the function. |
ignoreParams |
boolean |
false |
Whether or not to ignore the parameters of the function.</td> |
Returns
TranslatedCodeLine
[]
Defined in
kipper/target-ts/src/built-in-generator.ts:48
genTSVariable
▸ genTSVariable(varSpec
, value
): TranslatedCodeLine
Generates a JavaScript local or global variable from the given variable and value.
Parameters
Name | Type | Description |
---|---|---|
varSpec |
BuiltInVariable |
The variable to generate. |
value |
string |
The value of the variable. |
Returns
TranslatedCodeLine
Defined in
kipper/target-ts/src/built-in-generator.ts:65
getTSFunctionSignature
▸ getTSFunctionSignature(funcSpec
): Object
Generates the signature for the function based on the funcSpec, which can be used in an TypeScript env.
Since
0.10.0
Parameters
Name | Type | Description |
---|---|---|
funcSpec |
any |
The function spec object containing the metadata of the function. |
Returns
Object
Name | Type |
---|---|
identifier |
string |
params |
{ identifier : string ; type : ProcessedType }[] |
returnType |
ProcessedType |
Defined in
kipper/target-ts/src/tools.ts:20