This repository was archived by the owner on Nov 6, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -266,6 +266,7 @@ fun TypeNode.toKotlinType(typeMapper: ObjectTypeToKotlinTypeMapper): KtType {
266
266
267
267
SyntaxKind .TypeReference -> (this .cast<TypeReferenceNode >()).toKotlinTypeUnion(typeMapper).singleType
268
268
SyntaxKind .ExpressionWithTypeArguments -> (this .cast<ExpressionWithTypeArguments >()).toKotlinType(typeMapper)
269
+ SyntaxKind .TypeQuery -> (this .cast<TypeQueryNode >()).toKotlinType(typeMapper)
269
270
270
271
SyntaxKind .Identifier -> KtType (KtQualifiedName ((this .cast<Identifier >()).unescapedText))
271
272
SyntaxKind .TypeLiteral -> (this .cast<TypeLiteralNode >()).toKotlinType(typeMapper)
@@ -320,6 +321,10 @@ fun ExpressionWithTypeArguments.toKotlinType(typeMapper: ObjectTypeToKotlinTypeM
320
321
return KtType (name ? : KtQualifiedName (" ???" ), typeArguments?.arr?.map { typeMapper.mapType(it) } ? : emptyList())
321
322
}
322
323
324
+ fun TypeQueryNode.toKotlinType (typeMapper : ObjectTypeToKotlinTypeMapper ): KtType {
325
+ return KtType (DYNAMIC , comment = " typeof " + this .exprName.unsafeCast<Node >().stringifyQualifiedName()?.asString())
326
+ }
327
+
323
328
private fun PropertyAccessExpression.toKtQualifiedName (): KtQualifiedName {
324
329
val identifier = identifierName.unescapedText
325
330
Original file line number Diff line number Diff line change
1
+ package varTypeOf
2
+
3
+ external open class VarTypeOfClass {
4
+ open var myVar: dynamic /* typeof someOtherVar */ = definedExternally
5
+ }
Original file line number Diff line number Diff line change
1
+ declare class VarTypeOfClass {
2
+ myVar : typeof someOtherVar ;
3
+ }
You can’t perform that action at this time.
0 commit comments