-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Kotlin/JS doc update for 2.3.0 release #5192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AlejandraPedroza
wants to merge
1
commit into
2-3-0-doc-update
Choose a base branch
from
kotlin-js-doc-update
base: 2-3-0-doc-update
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -213,35 +213,59 @@ kotlin { | |||||
|
|
||||||
| 2. Enable the `BigInt` type. See how to enable it in [Use of `BigInt` type to represent Kotlin's `Long` type](#use-bigint-type-to-represent-kotlin-s-long-type). | ||||||
|
|
||||||
| ### Use `BigInt64Array` type to represent Kotlin's `LongArray` type | ||||||
| <primary-label ref="experimental-general"/> | ||||||
|
|
||||||
| Kotlin/JS uses JavaScript's built-in `BigInt64Array` type | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I need to enable this feature, it should probably be "can use", not "uses"? |
||||||
| to represent Kotlin's `LongArray` values when compiling to JavaScript. | ||||||
|
|
||||||
| To enable support for the `BigInt64Array` type, you need to add the following compiler option to your | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| `build.gradle(.kts)` file: | ||||||
|
|
||||||
| ```kotlin | ||||||
| // build.gradle.kts | ||||||
| kotlin { | ||||||
| js { | ||||||
| ... | ||||||
| compilerOptions { | ||||||
| freeCompilerArgs.add("-Xes-long-as-bigint") | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| This feature is [Experimental](components-stability.md#stability-levels-explained). Share your feedback in our issue tracker, | ||||||
| [YouTrack](https://youtrack.jetbrains.com/issue/KT-79284/Use-BigInt64Array-for-LongArray). | ||||||
|
|
||||||
| ## Kotlin types in JavaScript | ||||||
|
|
||||||
| See how Kotlin types are mapped to JavaScript ones: | ||||||
|
|
||||||
| | Kotlin | JavaScript | Comments | | ||||||
| |------------------------------------------------------------------|---------------------------|---------------------------------------------------------------------------------------| | ||||||
| | `Byte`, `Short`, `Int`, `Float`, `Double` | `Number` | | | ||||||
| | `Char` | `Number` | The number represents the character's code. | | ||||||
| | Kotlin | JavaScript | Comments | | ||||||
| |------------------------------------------------------------------|---------------------------|---------------------------------------------------------------------------------------------------------| | ||||||
| | `Byte`, `Short`, `Int`, `Float`, `Double` | `Number` | | | ||||||
| | `Char` | `Number` | The number represents the character's code. | | ||||||
| | `Long` | `BigInt` | Needs the [`-Xes-long-as-bigint` compiler option](compiler-reference.md#xes-long-as-bigint) configured. | | ||||||
| | `Boolean` | `Boolean` | | | ||||||
| | `String` | `String` | | | ||||||
| | `Array` | `Array` | | | ||||||
| | `ByteArray` | `Int8Array` | | | ||||||
| | `ShortArray` | `Int16Array` | | | ||||||
| | `IntArray` | `Int32Array` | | | ||||||
| | `CharArray` | `UInt16Array` | Carries the property `$type$ == "CharArray"`. | | ||||||
| | `FloatArray` | `Float32Array` | | | ||||||
| | `DoubleArray` | `Float64Array` | | | ||||||
| | `LongArray` | `Array<kotlin.Long>` | Carries the property `$type$ == "LongArray"`. Also see Kotlin's Long type comment. | | ||||||
| | `BooleanArray` | `Int8Array` | Carries the property `$type$ == "BooleanArray"`. | | ||||||
| | `List`, `MutableList` | `KtList`, `KtMutableList` | Exposes an `Array` via `KtList.asJsReadonlyArrayView` or `KtMutableList.asJsArrayView`. | | ||||||
| | `Map`, `MutableMap` | `KtMap`, `KtMutableMap` | Exposes an ES2015 `Map` via `KtMap.asJsReadonlyMapView` or `KtMutableMap.asJsMapView`. | | ||||||
| | `Set`, `MutableSet` | `KtSet`, `KtMutableSet` | Exposes an ES2015 `Set` via `KtSet.asJsReadonlySetView` or `KtMutableSet.asJsSetView`. | | ||||||
| | `Unit` | Undefined | Exportable when used as return type, but not when used as parameter type. | | ||||||
| | `Any` | `Object` | | | ||||||
| | `Throwable` | `Error` | | | ||||||
| | `enum class Type` | `Type` | Enum entries are exposed as static class properties (`Type.ENTRY`). | | ||||||
| | Nullable `Type?` | `Type | null | undefined` | | | ||||||
| | All other Kotlin types, except for those marked with `@JsExport` | Not supported | Includes Kotlin's [unsigned integer types](unsigned-integer-types.md). | | ||||||
| | `Boolean` | `Boolean` | | | ||||||
| | `String` | `String` | | | ||||||
| | `Array` | `Array` | | | ||||||
| | `ByteArray` | `Int8Array` | | | ||||||
| | `ShortArray` | `Int16Array` | | | ||||||
| | `IntArray` | `Int32Array` | | | ||||||
| | `CharArray` | `UInt16Array` | Carries the property `$type$ == "CharArray"`. | | ||||||
| | `FloatArray` | `Float32Array` | | | ||||||
| | `DoubleArray` | `Float64Array` | | | ||||||
| | `LongArray` | `BigInt64Array` | | | ||||||
| | `BooleanArray` | `Int8Array` | Carries the property `$type$ == "BooleanArray"`. | | ||||||
| | `List`, `MutableList` | `KtList`, `KtMutableList` | Exposes an `Array` via `KtList.asJsReadonlyArrayView` or `KtMutableList.asJsArrayView`. | | ||||||
| | `Map`, `MutableMap` | `KtMap`, `KtMutableMap` | Exposes an ES2015 `Map` via `KtMap.asJsReadonlyMapView` or `KtMutableMap.asJsMapView`. | | ||||||
| | `Set`, `MutableSet` | `KtSet`, `KtMutableSet` | Exposes an ES2015 `Set` via `KtSet.asJsReadonlySetView` or `KtMutableSet.asJsSetView`. | | ||||||
| | `Unit` | Undefined | Exportable when used as return type, but not when used as parameter type. | | ||||||
| | `Any` | `Object` | | | ||||||
| | `Throwable` | `Error` | | | ||||||
| | `enum class Type` | `Type` | Enum entries are exposed as static class properties (`Type.ENTRY`). | | ||||||
| | Nullable `Type?` | `Type | null | undefined` | | | ||||||
| | All other Kotlin types, except for those marked with `@JsExport` | Not supported | Includes Kotlin's [unsigned integer types](unsigned-integer-types.md). | | ||||||
|
|
||||||
| Additionally, it is important to know that: | ||||||
|
|
||||||
|
|
||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not about the change, but for consistency: The link text does not match the corresponding heading, should it? Both are grammatically correct, it just looks odd that they are different.