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

types: fix types #14401

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
4 changes: 2 additions & 2 deletions packages/server/lib/browsers/firefox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export function _createDetachedInstance (browserInstance: BrowserInstance): Brow
return detachedInstance
}

export async function open (browser: Browser, url, options: any = {}): Bluebird<BrowserInstance> {
export async function open (browser: Browser, url, options: any = {}): Promise<BrowserInstance> {
const defaultLaunchOptions = utils.getDefaultLaunchOptions({
extensions: [] as string[],
preferences: _.extend({}, defaultPreferences),
Expand Down Expand Up @@ -397,7 +397,7 @@ export async function open (browser: Browser, url, options: any = {}): Bluebird<
}

launchOptions.preferences['browser.cache.disk.parent_directory'] = cacheDir
for (let pref in launchOptions.preferences) {
for (const pref in launchOptions.preferences) {
const value = launchOptions.preferences[pref]

profile.setPreference(pref, value)
Expand Down
7 changes: 4 additions & 3 deletions packages/server/lib/socket-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ export class SocketBase {
}

createIo (server: DestroyableHttpServer, path: string, cookie: string | boolean) {
return socketIo.server(server, {
return new socketIo.SocketIOServer(server, {
path,
cookie,
cookie: {
name: cookie,
},
destroyUpgrade: false,
serveClient: false,
// parser: socketIo.circularParser as any,
transports: ['websocket'],
})
}
Expand Down
14 changes: 13 additions & 1 deletion packages/socket/lib/socket.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import fs from 'fs'
import server, { Server as SocketIOServer } from 'socket.io'
import server, { Server as SocketIOBaseServer, ServerOptions } from 'socket.io'
import { client } from './browser'
import http from 'http'

const { version } = require('socket.io-client/package.json')
const clientSource = require.resolve('socket.io-client/dist/socket.io.js')

export { ServerOptions }

// socket.io types are incorrect
type PatchedServerOptions = ServerOptions & { cookie: { name: string | boolean } }

class SocketIOServer extends SocketIOBaseServer {
constructor (srv: http.Server, opts?: Partial<PatchedServerOptions>) {
super(srv, opts)
}
}

export {
client,
server,
Expand Down
2 changes: 1 addition & 1 deletion packages/ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
/* Basic Options */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */
// "lib": [], /* Specify library files to be included in the compilation: */
// "allowJs": true, /* Allow javascript files to be compiled. */
Expand Down