mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-06 06:29:45 -06:00
chore: Add EventEmitter type to FileObject (#9276)
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
This commit is contained in:
21
cli/types/cypress-eventemitter.d.ts
vendored
21
cli/types/cypress-eventemitter.d.ts
vendored
@@ -6,3 +6,24 @@ interface EventEmitter extends EventEmitter2 {
|
||||
emitMap: (eventName: string, args: any[]) => Array<(...args: any[]) => any>
|
||||
emitThen: (eventName: string, args: any[]) => Bluebird.BluebirdStatic
|
||||
}
|
||||
|
||||
// Copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/events.d.ts
|
||||
// to avoid type conflict.
|
||||
interface NodeEventEmitter {
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
removeListener(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
off(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
removeAllListeners(event?: string | symbol): this
|
||||
setMaxListeners(n: number): this
|
||||
getMaxListeners(): number
|
||||
listeners(event: string | symbol): Array<(...args: any[]) => void>
|
||||
rawListeners(event: string | symbol): Array<(...args: any[]) => void>
|
||||
emit(event: string | symbol, ...args: any[]): boolean
|
||||
listenerCount(type: string | symbol): number
|
||||
// Added in Node 6...
|
||||
prependListener(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
|
||||
eventNames(): Array<string | symbol>
|
||||
}
|
||||
|
||||
2
cli/types/cypress.d.ts
vendored
2
cli/types/cypress.d.ts
vendored
@@ -4970,7 +4970,7 @@ declare namespace Cypress {
|
||||
dimensions?: Dimensions
|
||||
}
|
||||
|
||||
interface FileObject {
|
||||
interface FileObject extends NodeEventEmitter {
|
||||
filePath: string
|
||||
outputPath: string
|
||||
shouldWatch: boolean
|
||||
|
||||
@@ -28,6 +28,7 @@ const pluginConfig2: Cypress.PluginConfig = (on, config) => {
|
||||
file.filePath // $ExpectType string
|
||||
file.outputPath // $ExpectType string
|
||||
file.shouldWatch // $ExpectType boolean
|
||||
file.getMaxListeners // $ExpectType () => number
|
||||
|
||||
return file.outputPath
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user