Skip to content

Commit 3f3b494

Browse files
Concurrency: Explicitly mark Sendable conformance as unavailable for JSValue
1 parent 18ad4e3 commit 3f3b494

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/JavaScriptKit/JSValue.swift

+7
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ public enum JSValue: Equatable {
100100
}
101101
}
102102

103+
/// JSValue is intentionally not `Sendable` because accessing a JSValue living in a different
104+
/// thread is invalid. Although there are some cases where Swift allows sending a non-Sendable
105+
/// values to other isolation domains, not conforming `Sendable` is still useful to prevent
106+
/// accidental misuse.
107+
@available(*, unavailable)
108+
extension JSValue: Sendable {}
109+
103110
public extension JSValue {
104111
#if !hasFeature(Embedded)
105112
/// An unsafe convenience method of `JSObject.subscript(_ name: String) -> ((ConvertibleToJSValue...) -> JSValue)?`

0 commit comments

Comments
 (0)