Skip to content
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

Make opaque string types subtype String #603

Merged
merged 1 commit into from
Oct 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/AppendMode.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.scalajs.dom

opaque type AppendMode = String
opaque type AppendMode <: String = String

object AppendMode {
val segments: AppendMode = "segments"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/ClientType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.scalajs.dom

import scala.scalajs.js

opaque type ClientType = String
opaque type ClientType <: String = String

object ClientType {
val window: ClientType = "window"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/EndOfStreamError.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.scalajs.dom

opaque type EndOfStreamError = String
opaque type EndOfStreamError <: String = String

object EndOfStreamError {
val decode: EndOfStreamError = "decode"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/FrameType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.scalajs.dom

import scala.scalajs.js

opaque type FrameType = String
opaque type FrameType <: String = String

/** part of ServiceWorker
* [[https://slightlyoff.github.io/ServiceWorker/spec/service_worker_1/#client-frametype ¶4.2.2 frameType]] of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package org.scalajs.dom

import scala.scalajs.js

opaque type IDBTransactionDurability = String
opaque type IDBTransactionDurability <: String = String

object IDBTransactionDurability {
val default: IDBTransactionDurability = "default"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/IDBTransactionMode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import scala.scalajs.js
/** IndexedDB transaction mode Provides constants for IDB Transaction modes These constants have been removed from
* browser support and replaced by String values
*/
opaque type IDBTransactionMode = String
opaque type IDBTransactionMode <: String = String

object IDBTransactionMode {

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/KeyFormat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** see [[http://www.w3.org/TR/WebCryptoAPI/#dfn-KeyFormat ¶14.2 Data Types]] in W3C spec */
opaque type KeyFormat = String
opaque type KeyFormat <: String = String

object KeyFormat {

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/KeyType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** see [[http://www.w3.org/TR/WebCryptoAPI/#cryptokey-interface ¶13 CryptoKey interface]] in W3C doc */
opaque type KeyType = String
opaque type KeyType <: String = String

object KeyType {
val public: KeyType = "public"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/KeyUsage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** See [[http://www.w3.org/TR/WebCryptoAPI/#cryptokey-interface ¶ 13. CryptoKey Interface]] of w3c spec */
opaque type KeyUsage = String
opaque type KeyUsage <: String = String

object KeyUsage {
val encrypt: KeyUsage = "encrypt"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/MIMEType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.scalajs.dom

import scala.scalajs.js

opaque type MIMEType = String
opaque type MIMEType <: String = String

object MIMEType {
val `text/html`: MIMEType = "text/html"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/MediaDeviceKind.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** see [[https://www.w3.org/TR/2016/CR-mediacapture-streams-20160519/#idl-def-MediaDeviceKind]] in W3C spec */
opaque type MediaDeviceKind = String
opaque type MediaDeviceKind <: String = String

object MediaDeviceKind {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** see [[https://www.w3.org/TR/2013/WD-mediacapture-streams-20130903/#widl-MediaStream-onended]] in W3C spec */
opaque type MediaStreamTrackState = String
opaque type MediaStreamTrackState <: String = String

object MediaStreamTrackState {

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/PermissionName.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.scalajs.dom

import scala.scalajs.js

opaque type PermissionName = String
opaque type PermissionName <: String = String

object PermissionName {
val geolocation: PermissionName = "geolocation"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/PermissionState.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.scalajs.dom

import scala.scalajs.js

opaque type PermissionState = String
opaque type PermissionState <: String = String

object PermissionState {
val granted: PermissionState = "granted"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import scala.scalajs.js
/** This represents a JavaScript enumeration representing the various keys you an request from a [[PushSubscription]] as
* described here: [[http://www.w3.org/TR/push-api/#idl-def-PushEncryptionKeyName]]
*/
opaque type PushEncryptionKeyName = String
opaque type PushEncryptionKeyName <: String = String

/** Static definitions for [[PushEncryptionKeyName]] */
object PushEncryptionKeyName {
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/PushPermissionState.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import scala.scalajs.js
/** This represents a JavaScript enumeration describing the state of permissions for pushing described here:
* [[http://www.w3.org/TR/push-api/#idl-def-PushPermissionState]]
*/
opaque type PushPermissionState = String
opaque type PushPermissionState <: String = String

/** Static definitions for [[PushPermissionState]] */
object PushPermissionState {
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/RTCBundlePolicy.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** see [[https://www.w3.org/TR/2015/WD-webrtc-20150210/#idl-def-RTCBundlePolicy]] in W3C spec */
opaque type RTCBundlePolicy = String
opaque type RTCBundlePolicy <: String = String

object RTCBundlePolicy {

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/RTCDataChannelState.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** see [[https://www.w3.org/TR/2015/WD-webrtc-20150210/#idl-def-RTCDataChannelState]] in W3C spec */
opaque type RTCDataChannelState = String
opaque type RTCDataChannelState <: String = String

object RTCDataChannelState {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** see [[https://www.w3.org/TR/2015/WD-webrtc-20150210/#rtciceconnectionstate-enum]] in W3C spec */
opaque type RTCIceConnectionState = String
opaque type RTCIceConnectionState <: String = String

object RTCIceConnectionState {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.scalajs.dom

import scala.scalajs.js

opaque type RTCIceGatheringState = String
opaque type RTCIceGatheringState <: String = String

object RTCIceGatheringState {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** see [[https://www.w3.org/TR/2015/WD-webrtc-20150210/#idl-def-RTCIceTransportPolicy]] in W3C spec */
opaque type RTCIceTransportPolicy = String
opaque type RTCIceTransportPolicy <: String = String

object RTCIceTransportPolicy {

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/RTCSdpType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** see [[https://www.w3.org/TR/2015/WD-webrtc-20150210/#idl-def-RTCSdpType]] in W3C spec */
opaque type RTCSdpType = String
opaque type RTCSdpType <: String = String

object RTCSdpType {

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/RTCSignalingState.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.scalajs.dom

import scala.scalajs.js

opaque type RTCSignalingState = String
opaque type RTCSignalingState <: String = String

object RTCSignalingState {

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/RTCStatsType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** see [[https://www.w3.org/TR/2015/WD-webrtc-20150210/#idl-def-RTCStatsType]] in W3C spec */
opaque type RTCStatsType = String
opaque type RTCStatsType <: String = String

object RTCStatsType {

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/ReadyState.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.scalajs.dom

opaque type ReadyState = String
opaque type ReadyState <: String = String

object ReadyState {
val closed: ReadyState = "closed"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/ReferrerPolicy.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.scalajs.dom

import scala.scalajs.js

opaque type ReferrerPolicy = String
opaque type ReferrerPolicy <: String = String

object ReferrerPolicy {
val empty: ReferrerPolicy = ""
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/RequestCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** Fetch APIs [[https://fetch.spec.whatwg.org/#requestcache RequestCache enum]] */
opaque type RequestCache = String
opaque type RequestCache <: String = String

object RequestCache {
val default: RequestCache = "default"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/RequestCredentials.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** Fetch APIs [[https://fetch.spec.whatwg.org/#requestcredentials RequestCredentials enum]] */
opaque type RequestCredentials = String
opaque type RequestCredentials <: String = String

object RequestCredentials {
val omit: RequestCredentials = "omit"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/RequestDestination.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** Fetch APIs [[https://fetch.spec.whatwg.org/#requestdestination RequestDestination enum]] */
opaque type RequestDestination = String
opaque type RequestDestination <: String = String

object RequestDestination {
val empty: RequestDestination = ""
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/RequestMode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** Fetch API's [[https://fetch.spec.whatwg.org/#requestmode RequestMode enum]] */
opaque type RequestMode = String
opaque type RequestMode <: String = String

object RequestMode {
val navigate: RequestMode = "navigate"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/RequestRedirect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** Fetch API's [[https://fetch.spec.whatwg.org/#requestredirect RequestRedirect enum]] */
opaque type RequestRedirect = String
opaque type RequestRedirect <: String = String

object RequestRedirect {
val follow: RequestRedirect = "follow"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/RequestType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.scalajs.dom
import scala.scalajs.js

/** Fetch APIs [[https://fetch.spec.whatwg.org/#requesttype RequestType enum]] */
opaque type RequestType = String
opaque type RequestType <: String = String

object RequestType {
val empty: RequestType = ""
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/ResponseType.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.scalajs.dom

import scala.scalajs.js

opaque type ResponseType = String
opaque type ResponseType <: String = String

/** see [[https://fetch.spec.whatwg.org/#responsetype]] of whatwg Fetch spec */
object ResponseType {
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/ServiceWorkerState.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import scala.scalajs.js
/** See [[https://slightlyoff.github.io/ServiceWorker/spec/service_worker_1/#service-worker-obj ¶3.1 ServiceWorker]] of
* ServiceWorker whatwg spec.
*/
opaque type ServiceWorkerState = String
opaque type ServiceWorkerState <: String = String

object ServiceWorkerState {

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/TextTrackMode.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.scalajs.dom

opaque type TextTrackMode = String
opaque type TextTrackMode <: String = String

object TextTrackMode {
val disabled: TextTrackMode = "disabled"
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/VisibilityState.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package org.scalajs.dom

import scala.scalajs.js

opaque type VisibilityState = String
opaque type VisibilityState <: String = String

object VisibilityState {

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/org/scalajs/dom/WriteableState.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import scala.scalajs.js
// the stream API is defined in https://streams.spec.whatwg.org/

/** [[https://streams.spec.whatwg.org/#ws-state ¶4.2.4.3. get state]] of whatwg streams spec */
opaque type WriteableState = String
opaque type WriteableState <: String = String

object WriteableState {

Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/org/scalajs/dom/RTCConfiguration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ object RTCConfiguration {
peerIdentity: js.UndefOr[String] = js.undefined): RTCConfiguration = {
val result = js.Dynamic.literal()
iceServers.foreach(result.iceServers = _)
iceTransportPolicy.foreach(x => result.iceTransportPolicy = x.asInstanceOf[js.Any])
bundlePolicy.foreach(x => result.bundlePolicy = x.asInstanceOf[js.Any])
peerIdentity.foreach(x => result.peerIdentity = x.asInstanceOf[js.Any])
iceTransportPolicy.foreach(result.iceTransportPolicy = _)
bundlePolicy.foreach(result.bundlePolicy = _)
peerIdentity.foreach(result.peerIdentity = _)
japgolly marked this conversation as resolved.
Show resolved Hide resolved
result.asInstanceOf[RTCConfiguration]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ object RTCSessionDescriptionInit {
def apply(`type`: js.UndefOr[RTCSdpType] = js.undefined,
sdp: js.UndefOr[String] = js.undefined): RTCSessionDescriptionInit = {
val result = js.Dynamic.literal()
`type`.foreach(x => result.`type` = x.asInstanceOf[js.Any])
`type`.foreach(result.`type` = _)
sdp.foreach(result.sdp = _)
result.asInstanceOf[RTCSessionDescriptionInit]
}
Expand Down