Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

More prefer overload over default parameter #260

Merged
merged 1 commit into from
Jun 4, 2020
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
6 changes: 2 additions & 4 deletions app/nodejs-v14/src/main/scala/io/scalajs/nodejs/Assert.scala
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,8 @@ trait Assert extends js.Object {
* of the message parameter. If the message parameter is undefined, a default error message is assigned.
* @example assert.throws(block[, error][, message])
*/
def throws(block: js.Function,
error: js.RegExp | js.Function | js.Object | Error,
message: String = js.native
): Unit = js.native
def throws(block: js.Function, error: js.RegExp | js.Function | js.Object | Error, message: String): Unit = js.native
def throws(block: js.Function, error: js.RegExp | js.Function | js.Object | Error): Unit = js.native

def rejects(asyncFn: js.Function | js.Promise[_],
error: js.RegExp | js.Function | js.Object | Error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ trait Crypto extends js.Object {
def createCipheriv(algorithm: String,
key: String | BufferLike,
iv: String | BufferLike,
options: TransformOptions = js.native
): Cipher = js.native
options: TransformOptions
): Cipher = js.native
def createCipheriv(algorithm: String, key: String | BufferLike, iv: String | BufferLike): Cipher = js.native
@enableIf(io.scalajs.nodejs.internal.CompilerSwitches.gteNodeJs12)
def createCipheriv(algorithm: String, key: KeyObject, iv: String | BufferLike, options: TransformOptions): Cipher =
js.native
Expand All @@ -80,8 +81,9 @@ trait Crypto extends js.Object {
def createDecipheriv(algorithm: String,
key: String | BufferLike,
iv: String | BufferLike,
options: TransformOptions = js.native
): Decipher = js.native
options: TransformOptions
): Decipher = js.native
def createDecipheriv(algorithm: String, key: String | BufferLike, iv: String | BufferLike): Decipher = js.native
def createDecipheriv(algorithm: String,
key: KeyObject,
iv: String | BufferLike,
Expand Down
39 changes: 15 additions & 24 deletions app/nodejs-v14/src/main/scala/io/scalajs/nodejs/fs/Fs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1099,17 +1099,13 @@ trait Fs extends js.Object with FSConstants {
* @return undefined.
* @example fs.writeFileSync(file, data[, options])
*/
def writeFileSync(file: Path | FileDescriptor,
data: js.typedarray.Uint8Array,
options: FileWriteOptions = js.native
): Unit =
def writeFileSync(file: Path | FileDescriptor, data: js.typedarray.Uint8Array, options: FileWriteOptions): Unit =
js.native
def writeFileSync(file: Path | FileDescriptor, data: String, options: FileWriteOptions): Unit =
js.native
def writeFileSync(file: Path | FileDescriptor, data: String): Unit = js.native
def writeFileSync(file: Path | FileDescriptor, data: BufferLike, options: FileWriteOptions): Unit =
js.native
def writeFileSync(file: Path | FileDescriptor, data: BufferLike): Unit = js.native
def writeFileSync(file: Path | FileDescriptor, data: js.typedarray.Uint8Array): Unit = js.native
def writeFileSync(file: Path | FileDescriptor, data: String, options: FileWriteOptions): Unit = js.native
def writeFileSync(file: Path | FileDescriptor, data: String): Unit = js.native
def writeFileSync(file: Path | FileDescriptor, data: BufferLike, options: FileWriteOptions): Unit = js.native
def writeFileSync(file: Path | FileDescriptor, data: BufferLike): Unit = js.native

/**
* Write buffer to the file specified by fd.
Expand All @@ -1121,13 +1117,9 @@ trait Fs extends js.Object with FSConstants {
* @param position refers to the offset from the beginning of the file where this data should be written.
* @example {{{ fs.writeSync(fd, buffer[, offset[, length[, position]]]) }}}
*/
def writeSync(fd: FileDescriptor,
buffer: js.typedarray.Uint8Array,
offset: Int,
length: Int,
position: Int = js.native
): Unit =
def writeSync(fd: FileDescriptor, buffer: js.typedarray.Uint8Array, offset: Int, length: Int, position: Int): Unit =
js.native
def writeSync(fd: FileDescriptor, buffer: js.typedarray.Uint8Array, offset: Int, length: Int): Unit = js.native
def writeSync(fd: FileDescriptor, buffer: js.typedarray.Uint8Array, offset: Int): Unit = js.native
def writeSync(fd: FileDescriptor, buffer: js.typedarray.Uint8Array): Unit = js.native
def writeSync(fd: FileDescriptor, buffer: BufferLike, offset: Int, length: Int, position: Int): Unit = js.native
Expand Down Expand Up @@ -1155,10 +1147,9 @@ trait Fs extends js.Object with FSConstants {
fsCallback2: FsCallback2[Int, js.Array[js.typedarray.ArrayBufferView]]
): Unit = js.native
@enableIf(io.scalajs.nodejs.internal.CompilerSwitches.gteNodeJs12)
def writevSync(fd: FileDescriptor,
buffers: js.Array[js.typedarray.ArrayBufferView],
position: Int = js.native
): Unit = js.native
def writevSync(fd: FileDescriptor, buffers: js.Array[js.typedarray.ArrayBufferView], position: Int): Unit = js.native
@enableIf(io.scalajs.nodejs.internal.CompilerSwitches.gteNodeJs12)
def writevSync(fd: FileDescriptor, buffers: js.Array[js.typedarray.ArrayBufferView]): Unit = js.native
}

/**
Expand All @@ -1171,10 +1162,10 @@ object Fs extends Fs {
trait FsPromises extends js.Object {
def access(path: Path, mode: FileMode): js.Promise[Unit] = js.native

def appendFile(file: Path | FileDescriptor,
data: String | Buffer,
options: FileAppendOptions | String = js.native
): js.Promise[Unit] = js.native
def appendFile(file: Path | FileDescriptor, data: String | Buffer, options: FileAppendOptions): js.Promise[Unit] =
js.native
def appendFile(file: Path | FileDescriptor, data: String | Buffer, encoding: String): js.Promise[Unit] = js.native
def appendFile(file: Path | FileDescriptor, data: String | Buffer): js.Promise[Unit] = js.native

def chmod(path: Path, mode: FileMode): js.Promise[Unit] = js.native
def chown(path: Path, uid: UID, gid: GID): js.Promise[Unit] = js.native
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ import scala.scalajs.js.|

@js.native
trait Http2 extends js.Object {
def createServer(
options: Http2ServerOptions,
onRequestHandler: js.Function2[Http2ServerRequest, Http2ServerResponse, Any] = js.native
): Http2Server = js.native

def createSecureServer(
options: Http2SecureServerOptions,
onRequestHandler: js.Function2[Http2ServerRequest, Http2ServerResponse, Any] = js.native
): Http2SecureServer = js.native
def createServer(options: Http2ServerOptions, onRequestHandler: ServerCallback): Http2Server = js.native
def createServer(options: Http2ServerOptions): Http2Server = js.native

def createSecureServer(options: Http2SecureServerOptions, onRequestHandler: ServerCallback): Http2SecureServer =
js.native
def createSecureServer(options: Http2SecureServerOptions): Http2SecureServer = js.native

def connect(authority: String | URL, options: Http2ConnectOptions, listener: js.Function): ClientHttp2Session =
js.native
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import scala.scalajs.js
import scala.scalajs.js.|

package object http2 {
type Origin = String | URL | HasOrigin
type Path = String | Buffer | URL
type Origin = String | URL | HasOrigin
type Path = String | Buffer | URL
type ServerCallback = js.Function2[Http2ServerRequest, Http2ServerResponse, Any]

implicit final class Http2SessionExtensions[T <: Http2Session](private val instance: T) extends AnyVal {
@inline def onClose(handler: () => Any): T = instance.on("close", handler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ trait Https extends js.Object {
def get(url: String | URL, callback: js.Function1[ServerResponse, Any]): ClientRequest = js.native
def get(options: RequestOptions, callback: js.Function): ClientRequest = js.native

def request(url: String | URL,
options: RequestOptions,
callback: js.Function1[ServerResponse, Any] = js.native
): Unit = js.native
def request(url: String | URL, callback: js.Function1[ServerResponse, Any]): Unit = js.native
def request(url: String | URL): Unit = js.native
def request(options: RequestOptions): Unit = js.native
def request(options: RequestOptions, callback: js.Function1[ServerResponse, Any]): Unit = js.native
def request(url: String | URL, options: RequestOptions, callback: js.Function1[ServerResponse, Any]): Unit = js.native
def request(url: String | URL, options: RequestOptions): Unit = js.native
def request(url: String | URL, callback: js.Function1[ServerResponse, Any]): Unit = js.native
def request(url: String | URL): Unit = js.native
def request(options: RequestOptions): Unit = js.native
def request(options: RequestOptions, callback: js.Function1[ServerResponse, Any]): Unit = js.native
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,8 @@ trait Process extends IEventEmitter {
* @example {{{ process.send(message[, sendHandle[, options]][, callback]) }}}
* @since 0.5.9
*/
def send(message: js.Any,
sendHandle: SendHandle,
options: TransferOptions,
callback: js.Function = js.native
): Boolean = js.native
def send(message: js.Any, sendHandle: SendHandle, options: TransferOptions, callback: js.Function): Boolean =
js.native
def send(message: js.Any, sendHandle: SendHandle, options: TransferOptions): Boolean = js.native
def send(message: js.Any, sendHandle: SendHandle, callback: js.Function): Boolean = js.native
def send(message: js.Any, sendHandle: SendHandle): Boolean = js.native
Expand Down
14 changes: 5 additions & 9 deletions app/nodejs-v14/src/main/scala/io/scalajs/nodejs/vm/VM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ import scala.scalajs.js.|
*/
@js.native
trait VM extends js.Object {
def compileFunction(code: String,
params: js.Array[String],
options: CompileFunctionOptions = js.native
): js.Function = js.native
def compileFunction(code: String): js.Function = js.native
def compileFunction(code: String, params: js.Array[String], options: CompileFunctionOptions): js.Function = js.native
def compileFunction(code: String, params: js.Array[String]): js.Function = js.native
def compileFunction(code: String): js.Function = js.native

/**
* If given a sandbox object, the vm.createContext() method will
Expand Down Expand Up @@ -54,10 +52,8 @@ trait VM extends js.Object {
* @param options the optional options
* @example script.runInContext(contextifiedSandbox[, options])
*/
def runInContext(code: String,
contextifiedSandbox: ScriptContext,
options: VMRunInContextOptions = js.native
): js.Any = js.native
def runInContext(code: String, contextifiedSandbox: ScriptContext, options: VMRunInContextOptions): js.Any = js.native
def runInContext(code: String, contextifiedSandbox: ScriptContext): js.Any = js.native

/**
* First contextifies the given sandbox, runs the compiled code contained by the vm.Script object within the created
Expand Down