[Wasm] Add internal JsPrimitive annotation

Before external classes could only represent JS object types and are
type-checked with `instanceof`.
@JsPrimitive allows external classes to represent primitive types with
`typeof` checks.
This commit is contained in:
Svyatoslav Kuzmich
2023-03-10 10:43:15 +01:00
committed by Space Team
parent 1e91fe155b
commit d6886d69ec
3 changed files with 26 additions and 5 deletions
@@ -0,0 +1,13 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.wasm.internal
/**
* Annotated external classes correspond to JS primitive type.
* @param type is a result of JS `typeof` operator applied to this type.
*/
@Target(AnnotationTarget.CLASS)
internal annotation class JsPrimitive(val type: String)