Skip to content

Commit b21aef6

Browse files
authored
Merge pull request #500 from sjrd/no-at-field-in-export
Fix #499: Remove the mention of `@field` in constructor param export.
2 parents 4c56430 + 628775f commit b21aef6

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

doc/interoperability/export-to-javascript.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,19 +319,18 @@ disambiguate, the methods in the error messages will be prefixed by
319319
`$js$exported$prop$`.
320320

321321
### <a name="constructor-params"></a> Export fields directly declared in constructors
322-
If you want to export fields that are directly declared in a class constructor, you'll have to use the `@field` meta annotation to avoid annotating the constructor arguments (exporting an argument is nonsensical and will fail):
323322

324-
{% highlight scala %}
325-
import scala.annotation.meta.field
323+
You can export fields directly declared in constructors by annotating the constructor argument:
326324

325+
{% highlight scala %}
327326
class Point(
328-
@(JSExport @field) val x: Double,
329-
@(JSExport @field) val y: Double)
327+
@JSExport val x: Double,
328+
@JSExport val y: Double)
330329

331330
// Also applies to case classes
332331
case class Point(
333-
@(JSExport @field) x: Double,
334-
@(JSExport @field) y: Double)
332+
@JSExport x: Double,
333+
@JSExport y: Double)
335334
{% endhighlight %}
336335

337336
## Export fields to the top level

0 commit comments

Comments
 (0)