diff --git a/types/ansi/ansi-tests.ts b/types/ansi/ansi-tests.ts index b2625defa5..0c033c6839 100644 --- a/types/ansi/ansi-tests.ts +++ b/types/ansi/ansi-tests.ts @@ -22,7 +22,7 @@ Object.keys({ }).forEach((color) => { const cname = color.replace(/([a-z])([A-Z])/g, (_: string, l: string, u: string): string => `${l} ${u.toLowerCase()}`); - ((<(...anything: any[]) => ansi.Cursor> cursor[color])() + ((cursor[color] as (...anything: any[]) => ansi.Cursor)() .bold() .bg)[color === 'blue' || color === 'brightBlue' ? 'black' : 'blue']() .write( diff --git a/types/async/test/index.ts b/types/async/test/index.ts index 0081dd3dcd..574a5ed8b9 100644 --- a/types/async/test/index.ts +++ b/types/async/test/index.ts @@ -390,22 +390,22 @@ async.auto({ get_data: function (callback: AsyncResultCallback) { }, make_folder: function (callback: AsyncResultCallback) { }, //arrays with different types are not accepted by TypeScript. - write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback) { + write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback) { callback(null, filename); - }], + } as any], //arrays with different types are not accepted by TypeScript. - email_link: ['write_file', function (callback: AsyncResultCallback, results: any) { }] + email_link: ['write_file', function (callback: AsyncResultCallback, results: any) { } as any] }); async.auto({ get_data: function (callback: AsyncResultCallback) { }, make_folder: function (callback: AsyncResultCallback) { }, //arrays with different types are not accepted by TypeScript. - write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback) { + write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback) { callback(null, filename); - }], + } as any], //arrays with different types are not accepted by TypeScript. - email_link: ['write_file', function (callback: AsyncResultCallback, results: any) { }] + email_link: ['write_file', function (callback: AsyncResultCallback, results: any) { } as any] }, function (err, results) { console.log('finished auto'); }); @@ -421,11 +421,11 @@ async.auto({ get_data: function (callback: AsyncResultCallback) { }, make_folder: function (callback: AsyncResultCallback) { }, //arrays with different types are not accepted by TypeScript. - write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback) { + write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback) { callback(null, filename); - }], + } as any], //arrays with different types are not accepted by TypeScript. - email_link: ['write_file', function (callback: AsyncResultCallback, results: any) { }] + email_link: ['write_file', function (callback: AsyncResultCallback, results: any) { } as any] }, 1, function (err, results) { console.log('finished auto'); }); diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index 6acca94fc5..9a04b9c7b6 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -557,8 +557,8 @@ function testDesializerManager() { } function isStorableClass(o: object): o is StorableClass { - if (typeof o === "object" && ( o).name && - ( o).name === "test") { + if (typeof o === "object" && (o as StorableClass).name && + (o as StorableClass).name === "test") { return true; } else { return false; diff --git a/types/baconjs/baconjs-tests.ts b/types/baconjs/baconjs-tests.ts index 2755bec595..b7d6db4c0f 100644 --- a/types/baconjs/baconjs-tests.ts +++ b/types/baconjs/baconjs-tests.ts @@ -120,7 +120,7 @@ function CommonMethodsInEventStreamsAndProperties() { Bacon.fromArray([1, 2, 3]).withStateMachine(0, (sum, event) => { if (event.hasValue()) { // had to cast to `number` because event:Bacon.Next|Bacon.Error<{}> - return [sum + event.value(), []]; + return [sum + (event.value() as number), []]; } else if (event.isEnd()) { return [undefined, [new Bacon.Next(sum), event]]; @@ -140,8 +140,8 @@ function CommonMethodsInEventStreamsAndProperties() { { // This is handy for keeping track whether we are currently awaiting an AJAX response: - var ajaxRequest = >{}, - ajaxResponse = >{}, + var ajaxRequest = {} as Bacon.Observable, + ajaxResponse = {} as Bacon.Observable, showAjaxIndicator = ajaxRequest.awaiting(ajaxResponse); } diff --git a/types/bell/bell-tests.ts b/types/bell/bell-tests.ts index 5eaeac4f35..26a29670a0 100644 --- a/types/bell/bell-tests.ts +++ b/types/bell/bell-tests.ts @@ -16,7 +16,7 @@ async function run() { clientSecret: '', scope(request) { const scopes = ['public_profile', 'email']; - if (( request.query).wantsSharePermission) { + if ((request.query as RequestQuery).wantsSharePermission) { scopes.push('publish_actions'); } return scopes; diff --git a/types/d3kit/d3kit-tests.ts b/types/d3kit/d3kit-tests.ts index ec3b2de1ce..705b9fcc59 100644 --- a/types/d3kit/d3kit-tests.ts +++ b/types/d3kit/d3kit-tests.ts @@ -304,7 +304,7 @@ function test_svg_chart() { * Test plate functions */ plate = new d3kit.SvgPlate(); - plate = chart.addPlate('a-plate', plate, true); // with doNotAppend + plate = chart.addPlate('a-plate', plate, true) as d3kit.SvgPlate; // with doNotAppend chart = chart.addPlate('a-plate', plate); // without doNotAppend chart = chart.removePlate('a-plate'); @@ -381,7 +381,7 @@ function test_hybrid_chart() { * Test plate functions */ plate = new d3kit.SvgPlate(); - plate = chart.addPlate('a-plate', plate, true); // with doNotAppend + plate = chart.addPlate('a-plate', plate, true) as d3kit.SvgPlate; // with doNotAppend chart = chart.addPlate('a-plate', plate); // without doNotAppend chart = chart.removePlate('a-plate'); diff --git a/types/d3kit/v1/d3kit-tests.ts b/types/d3kit/v1/d3kit-tests.ts index 18f1f144f9..92c20fa35d 100644 --- a/types/d3kit/v1/d3kit-tests.ts +++ b/types/d3kit/v1/d3kit-tests.ts @@ -380,8 +380,8 @@ describe('Skeleton', function(){ b: 2 }); expect(skeleton).to.include.keys(['a', 'b']); - expect((skeleton).a).to.equal(1); - expect((skeleton).b).to.equal(2); + expect((skeleton as any).a).to.equal(1); + expect((skeleton as any).b).to.equal(2); }); it('should overwrite existing fields', function(){ skeleton.mixin({ @@ -391,7 +391,7 @@ describe('Skeleton', function(){ b: 3 }); expect(skeleton).to.include.keys(['b']); - expect((skeleton).b).to.equal(3); + expect((skeleton as any).b).to.equal(3); }); it('should keep original fields if not overwritten', function(){ skeleton.mixin({ @@ -403,9 +403,9 @@ describe('Skeleton', function(){ b: 3 }); expect(skeleton).to.include.keys(['a', 'b', 'c']); - expect((skeleton).a).to.equal(1); - expect((skeleton).b).to.equal(3); - expect((skeleton).c).to.equal(20); + expect((skeleton as any).a).to.equal(1); + expect((skeleton as any).b).to.equal(3); + expect((skeleton as any).c).to.equal(20); }); }); @@ -720,7 +720,7 @@ describe('Chartlet', function(){ beforeEach(function(done){ ChildChartlet = function() { var chartlet = new d3kit.Chartlet(callback, callback, callback); - (chartlet).runTest = function (testFunction: any) { + (chartlet as any).runTest = function (testFunction: any) { testFunction(chartlet); }; return chartlet; @@ -730,7 +730,7 @@ describe('Chartlet', function(){ var chartlet = new d3kit.Chartlet(callback, callback, callback); var child = ChildChartlet(); configureFunction(chartlet, child); - (chartlet).runTest = (child).runTest; + (chartlet as any).runTest = (child as any).runTest; return chartlet; }; @@ -850,7 +850,7 @@ describe('Chartlet', function(){ }) .property('foo', function(d:number) {return 2 * d;}); - (parent).runTest(function(child: d3kit.Chartlet) { + (parent as any).runTest(function(child: d3kit.Chartlet) { expect(child.getPropertyValue('bar', 4, 0)).to.be.equal(8); }); }); @@ -862,7 +862,7 @@ describe('Chartlet', function(){ }) .property('foo', function(d:number) {return 2 * d;}); - (parent).runTest(function(child: d3kit.Chartlet) { + (parent as any).runTest(function(child: d3kit.Chartlet) { expect(child.getPropertyValue('foo', 4, 0)).to.be.equal(8); }); }); @@ -878,7 +878,7 @@ describe('Chartlet', function(){ .property('bar', function(d:number) {return 3 * d;}) .property('baz', function(d:number) {return 4 * d;}); - (parent).runTest(function(child: d3kit.Chartlet) { + (parent as any).runTest(function(child: d3kit.Chartlet) { expect(child.getPropertyValue('foo-x', 1, 0)).to.be.equal(2); expect(child.getPropertyValue('bar-x', 1, 0)).to.be.equal(3); expect(child.getPropertyValue('baz-x', 1, 0)).to.be.equal(4); @@ -894,7 +894,7 @@ describe('Chartlet', function(){ .property('bar', function(d:number) {return 3 * d;}) .property('baz', function(d:number) {return 4 * d;}); - (parent).runTest(function(child: d3kit.Chartlet) { + (parent as any).runTest(function(child: d3kit.Chartlet) { expect(child.getPropertyValue('foo', 1, 0)).to.be.equal(2); expect(child.getPropertyValue('bar', 1, 0)).to.be.equal(3); expect(child.getPropertyValue('baz', 1, 0)).to.be.equal(4); @@ -914,7 +914,7 @@ describe('Chartlet', function(){ var child = new d3kit.Chartlet(callback, callback, callback, ['foo']) .publishEventsTo(parent.getDispatcher()); - (child.getDispatcher()).foo(99); + (child.getDispatcher() as any).foo(99); }); }); }); diff --git a/types/db-migrate-base/db-migrate-base-tests.ts b/types/db-migrate-base/db-migrate-base-tests.ts index 79d81a75f9..e9c46f4873 100644 --- a/types/db-migrate-base/db-migrate-base-tests.ts +++ b/types/db-migrate-base/db-migrate-base-tests.ts @@ -3,7 +3,7 @@ import * as DbMigrateBase from "db-migrate-base"; // Throw together a dummy driver -let db = {}; +let db = {} as DbMigrateBase.Base; let callback = (err: any, response: any) => { // Do nothing. diff --git a/types/db-migrate-pg/db-migrate-pg-tests.ts b/types/db-migrate-pg/db-migrate-pg-tests.ts index adf2716074..b31d88e37d 100644 --- a/types/db-migrate-pg/db-migrate-pg-tests.ts +++ b/types/db-migrate-pg/db-migrate-pg-tests.ts @@ -3,7 +3,7 @@ import * as DbMigratePg from "db-migrate-pg"; // Throw together a dummy driver -let db = {}; +let db = {} as DbMigratePg.PgDriver; let callback = (err: any, response: any) => { // Do nothing. diff --git a/types/dot-prop/dot-prop-tests.ts b/types/dot-prop/dot-prop-tests.ts index 420fe2d320..7b21eb76c9 100644 --- a/types/dot-prop/dot-prop-tests.ts +++ b/types/dot-prop/dot-prop-tests.ts @@ -18,6 +18,6 @@ dotProp.has({foo: {bar: 'unicorn'}}, 'foo.bar'); dotProp.delete(obj, 'foo.bar'); console.log(obj); -( obj).foo.bar = {x: 'y', y: 'x'}; +(obj as any).foo.bar = {x: 'y', y: 'x'}; dotProp.delete(obj, 'foo.bar.x'); console.log(obj); diff --git a/types/duplexer3/duplexer3-tests.ts b/types/duplexer3/duplexer3-tests.ts index c540828d5d..03c5107e94 100644 --- a/types/duplexer3/duplexer3-tests.ts +++ b/types/duplexer3/duplexer3-tests.ts @@ -8,7 +8,7 @@ writable._write = (input, encoding, done) => { if (readable.push(input)) { done(); } else { - readable.once('drain', <(...args: any[]) => void> done); + readable.once('drain', done as (...args: any[]) => void); } }; diff --git a/types/easy-api-request/easy-api-request-tests.ts b/types/easy-api-request/easy-api-request-tests.ts index 02b2bc92bf..e1999170fe 100644 --- a/types/easy-api-request/easy-api-request-tests.ts +++ b/types/easy-api-request/easy-api-request-tests.ts @@ -17,7 +17,7 @@ APIRequest.create({ var app = express(); app.get('/', function (req:any, res:express.Response) { - var rMaker = req.testAPI; + var rMaker = req.testAPI as APIRequest.RequestMaker; var r = rMaker(); r.get('/', function (err, resp) { if(err) { @@ -28,7 +28,7 @@ app.get('/', function (req:any, res:express.Response) { }); app.get('/', function (req:any, res:express.Response) { - var rMaker = req.testAPI; + var rMaker = req.testAPI as APIRequest.RequestMaker; var r = rMaker(); r.get('/') .then(function (resp) { diff --git a/types/express-fileupload/express-fileupload-tests.ts b/types/express-fileupload/express-fileupload-tests.ts index 2a268fb64e..f423e5035a 100644 --- a/types/express-fileupload/express-fileupload-tests.ts +++ b/types/express-fileupload/express-fileupload-tests.ts @@ -9,7 +9,7 @@ const app: express.Express = express(); app.use(fileUpload({debug: true})); function isUploadedFile(file: UploadedFile | UploadedFile[]): file is UploadedFile { - return typeof file === 'object' && ( file).name !== undefined; + return typeof file === 'object' && (file as UploadedFile).name !== undefined; } const uploadHandler: RequestHandler = (req: Request, res: Response, next: NextFunction) => { diff --git a/types/hapi/v12/hapi-tests.ts b/types/hapi/v12/hapi-tests.ts index 32d1aff704..287a071d38 100644 --- a/types/hapi/v12/hapi-tests.ts +++ b/types/hapi/v12/hapi-tests.ts @@ -6,7 +6,7 @@ import * as Hapi from 'hapi'; // Create a server with a host and port var server = new Hapi.Server(); -server.connection({ +server.connection({ host: "localhost", port: 8000 }); diff --git a/types/hapi/v16/test/continuation/errors.ts b/types/hapi/v16/test/continuation/errors.ts index 165e5214df..2f9fedaaf5 100644 --- a/types/hapi/v16/test/continuation/errors.ts +++ b/types/hapi/v16/test/continuation/errors.ts @@ -26,7 +26,7 @@ const handleError: Hapi.ContinuationValueFunction = (err?: Boom.BoomError | null handleError(Boom.badData()); // Accepts an error with custom data -const errorWithData = Boom.badImplementation('', { custom1: 'test', customType: <'Custom1'>'Custom1', isCustom: true }); +const errorWithData = Boom.badImplementation('', { custom1: 'test', customType: 'Custom1' as 'Custom1', isCustom: true as true }); handleError(errorWithData); // Accepts an error with a more explicit type diff --git a/types/hapi/v16/test/route/additional-options.ts b/types/hapi/v16/test/route/additional-options.ts index ccbb36af15..7ab2171776 100644 --- a/types/hapi/v16/test/route/additional-options.ts +++ b/types/hapi/v16/test/route/additional-options.ts @@ -10,28 +10,28 @@ var authConfig: Hapi.RouteAdditionalConfigurationOptions = { var extConfigSingle: Hapi.RouteAdditionalConfigurationOptions = { ext: { type: 'onPreAuth', - method: function (request, reply) { + method: function (request, reply) { reply('ok'); - } + } as Hapi.ServerExtRequestHandler } } var extConfigMulti: Hapi.RouteAdditionalConfigurationOptions = { ext: [{ type: 'onPreAuth', - method: function (request, reply) { + method: function (request, reply) { reply('ok'); - } + } as Hapi.ServerExtRequestHandler }, { type: 'onPostAuth', - method: function (request, reply) { + method: function (request, reply) { reply('ok'); - } + } as Hapi.ServerExtRequestHandler }, { type: 'onPostStart', - method: function (server, next) { + method: function (server, next) { next(); - } + } as Hapi.ServerExtFunction }] } diff --git a/types/hapi/v16/test/route/public-interface.ts b/types/hapi/v16/test/route/public-interface.ts index f3878cea48..dad79e7306 100644 --- a/types/hapi/v16/test/route/public-interface.ts +++ b/types/hapi/v16/test/route/public-interface.ts @@ -2,7 +2,7 @@ import * as Hapi from '../../'; -var route = {}; +var route = {} as Hapi.RoutePublicInterface; var a: string = route.method; var a: string = route.path; @@ -14,4 +14,4 @@ if (typeof(route.vhost) == 'string') { var c: Hapi.ServerRealm = route.realm; var d: Hapi.RouteAdditionalConfigurationOptions = route.settings; var a: string = route.fingerprint; -var e: boolean = route.auth.access( {}); +var e: boolean = route.auth.access({} as Hapi.Request); diff --git a/types/hapi/v16/test/route/validate.ts b/types/hapi/v16/test/route/validate.ts index 06fefcc62e..42d6872570 100644 --- a/types/hapi/v16/test/route/validate.ts +++ b/types/hapi/v16/test/route/validate.ts @@ -55,10 +55,10 @@ const responseValidationFunction: Hapi.ValidationFunctionForRouteResponse>{ + response: { schema: responseValidationFunction, options: { myOption: 18 } - } + } as Hapi.RouteResponseConfigurationObject }; diff --git a/types/hapi/v16/test/server/listener.ts b/types/hapi/v16/test/server/listener.ts index 85ddb18bc6..84eda35ed5 100644 --- a/types/hapi/v16/test/server/listener.ts +++ b/types/hapi/v16/test/server/listener.ts @@ -15,5 +15,5 @@ io.sockets.on('connection', (socket) => { // a wrapper around socket.io. Much less likely is either // a type error in the TypeScript definitions of socket.io or // an error in the Hapi docs. - socket.emit( { msg: 'welcome' }); + socket.emit({ msg: 'welcome' } as any); }); diff --git a/types/html-webpack-plugin/html-webpack-plugin-tests.ts b/types/html-webpack-plugin/html-webpack-plugin-tests.ts index 461e43c2af..7abb6a4ed6 100644 --- a/types/html-webpack-plugin/html-webpack-plugin-tests.ts +++ b/types/html-webpack-plugin/html-webpack-plugin-tests.ts @@ -103,7 +103,7 @@ const plugins: HtmlWebpackPlugin[] = optionsArray.map(options => new HtmlWebpack // Webpack plugin `apply` function function apply(compiler: Compiler) { compiler.hooks.compilation.tap('SomeWebpackPlugin', (compilation: compilation.Compilation) => { - ( compilation.hooks).htmlWebpackPluginAfterHtmlProcessing.tap( + (compilation.hooks as HtmlWebpackPlugin.Hooks).htmlWebpackPluginAfterHtmlProcessing.tap( 'MyPlugin', (data) => { data.html += 'The Magic Footer'; diff --git a/types/http-assert/http-assert-tests.ts b/types/http-assert/http-assert-tests.ts index a0e159aeed..b2cc7ae301 100644 --- a/types/http-assert/http-assert-tests.ts +++ b/types/http-assert/http-assert-tests.ts @@ -5,7 +5,7 @@ try { httpAssert.equal('hello', 'hello'); httpAssert(false, 401, 'authentication failed'); } catch (err) { - console.log(( err).status); - console.log(( err).message); - console.log(( err).expose); + console.log((err as HttpError).status); + console.log((err as HttpError).message); + console.log((err as HttpError).expose); } diff --git a/types/irc/irc-tests.ts b/types/irc/irc-tests.ts index b2603e7037..284bb190c7 100644 --- a/types/irc/irc-tests.ts +++ b/types/irc/irc-tests.ts @@ -13,15 +13,15 @@ function test_bot() { console.log("Connected"); }); - bot.addListener('error', ((message: irc.IMessage) => { + bot.addListener('error', ((message: irc.IMessage) => { console.error('ERROR: %s: %s', message.command, message.args.join(' ')); - })); + }) as irc.handlers.IError); - bot.addListener('message#blah', ((from: string, message: string) => { + bot.addListener('message#blah', ((from: string, message: string) => { console.log('<%s> %s', from, message); - })); + }) as irc.handlers.IMessageChannel); - bot.addListener('message', ((from: string, to: string, message: string) => { + bot.addListener('message', ((from: string, to: string, message: string) => { console.log('%s => %s: %s', from, to, message); if (to.match(/^[#&]/)) { @@ -40,23 +40,23 @@ function test_bot() { // private message console.log('private message'); } - })); + }) as irc.handlers.IRecievedMessage); - bot.addListener('pm', ((nick: string, message: string) => { + bot.addListener('pm', ((nick: string, message: string) => { console.log('Got private message from %s: %s', nick, message); - })); + }) as irc.handlers.IPm); - bot.addListener('join', ((channel: string, who: string) => { + bot.addListener('join', ((channel: string, who: string) => { console.log('%s has joined %s', who, channel); - })); + }) as irc.handlers.IJoin); - bot.addListener('part', ((channel: string, who: string, reason: string) => { + bot.addListener('part', ((channel: string, who: string, reason: string) => { console.log('%s has left %s: %s', who, channel, reason); - })); + }) as irc.handlers.IPart); - bot.addListener('kick', ((channel: string, who: string, by: string, reason: string) => { + bot.addListener('kick', ((channel: string, who: string, by: string, reason: string) => { console.log('%s was kicked from %s by %s: %s', who, channel, by, reason); - })); + }) as irc.handlers.IKick); } function test_secure() { diff --git a/types/jsdom/jsdom-tests.ts b/types/jsdom/jsdom-tests.ts index d20232e36f..1420723b8d 100644 --- a/types/jsdom/jsdom-tests.ts +++ b/types/jsdom/jsdom-tests.ts @@ -120,7 +120,7 @@ function test_runVMScript() { dom.runVMScript(s); dom.runVMScript(s); - ( dom.window).ran === 3; + (dom.window as any).ran === 3; } function test_reconfigure() { diff --git a/types/maker.js/maker.js-tests.ts b/types/maker.js/maker.js-tests.ts index f5f9d9db16..ba02fdef89 100644 --- a/types/maker.js/maker.js-tests.ts +++ b/types/maker.js/maker.js-tests.ts @@ -100,9 +100,9 @@ function test() { function testKit() { makerjs.kit.construct(null, null); makerjs.kit.getParameterValues(null); - ({}).max; - ({}).metaParameters; - ({}).notes; + ({} as MakerJs.IMetaParameter).max; + ({} as MakerJs.IKit).metaParameters; + ({} as MakerJs.IKit).notes; } function testMeasure() { diff --git a/types/meteor/test/globals/meteor-tests.ts b/types/meteor/test/globals/meteor-tests.ts index b902019aca..782701086f 100644 --- a/types/meteor/test/globals/meteor-tests.ts +++ b/types/meteor/test/globals/meteor-tests.ts @@ -697,7 +697,7 @@ Accounts.onPageLoadLogin(function () { }); // Covers this PR: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/8065 -var loginOpts = { +var loginOpts = { requestPermissions: ["a", "b"], requestOfflineToken: true, loginUrlParameters: { asdf: 1, qwer: "1234" }, @@ -705,7 +705,7 @@ var loginOpts = { loginStyle: "Bold and powerful", redirectUrl: "popup", profile: "asdfasdf" -}; +} as Meteor.LoginWithExternalServiceOptions; Meteor.loginWithMeteorDeveloperAccount(loginOpts, function (error: Meteor.Error) { }); Accounts.emailTemplates.siteName = "AwesomeSite"; @@ -748,7 +748,7 @@ const deeperPrivateSetting = Meteor.settings['somePrivateSettings']['deeperSetti // Covers https://github.com/meteor-typings/meteor/issues/9 -const username = (Template.instance().find('#username')).value; +const username = (Template.instance().find('#username') as HTMLInputElement).value; // Covers https://github.com/meteor-typings/meteor/issues/3 diff --git a/types/meteor/test/meteor-tests.ts b/types/meteor/test/meteor-tests.ts index 4901e810c5..b45284df52 100644 --- a/types/meteor/test/meteor-tests.ts +++ b/types/meteor/test/meteor-tests.ts @@ -709,7 +709,7 @@ Accounts.onPageLoadLogin(function () { }); // Covers this PR: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/8065 -var loginOpts = { +var loginOpts = { requestPermissions: ["a", "b"], requestOfflineToken: true, loginUrlParameters: { asdf: 1, qwer: "1234" }, @@ -717,7 +717,7 @@ var loginOpts = { loginStyle: "Bold and powerful", redirectUrl: "popup", profile: "asdfasdf" -}; +} as Meteor.LoginWithExternalServiceOptions; Meteor.loginWithMeteorDeveloperAccount(loginOpts, function (error: Meteor.Error) { }); Accounts.emailTemplates.siteName = "AwesomeSite"; @@ -760,7 +760,7 @@ const deeperPrivateSetting = Meteor.settings['somePrivateSettings']['deeperSetti // Covers https://github.com/meteor-typings/meteor/issues/9 -const username = (Template.instance().find('#username')).value; +const username = (Template.instance().find('#username') as HTMLInputElement).value; // Covers https://github.com/meteor-typings/meteor/issues/3 diff --git a/types/mongoose-paginate/mongoose-paginate-tests.ts b/types/mongoose-paginate/mongoose-paginate-tests.ts index 320077bc3a..d55f8a454e 100644 --- a/types/mongoose-paginate/mongoose-paginate-tests.ts +++ b/types/mongoose-paginate/mongoose-paginate-tests.ts @@ -40,7 +40,7 @@ let router: Router = Router(); router.get('/users.json', function(req: Request, res: Response) { let descending: boolean = true; - let options: PaginateOptions = {}; + let options: PaginateOptions = {} as PaginateOptions; options.select = 'email username'; options.sort = { 'username': (descending ? -1 : 1) }; options.populate = ''; diff --git a/types/mz/mz-tests.ts b/types/mz/mz-tests.ts index b873c98bbe..a4ec4667a7 100644 --- a/types/mz/mz-tests.ts +++ b/types/mz/mz-tests.ts @@ -136,7 +136,7 @@ describe('readline', function () { var input = new stream.PassThrough() var output = new stream.PassThrough() var bufferedOutput = '' - var rl = readline.createInterface( input, output, completer, true ) + var rl = readline.createInterface( input, output, completer as readline.Completer, true ) rl.question('a').then(function (answer: string) { assert.equal(answer, 'bTESTSTRING') @@ -174,12 +174,12 @@ describe('readline', function () { it('completer support sync', function (done) { function completer (line: string) { assert.equal(line, 'b') - return <[string[], string]>[['bTESTSTRING'], line] + return [['bTESTSTRING'], line] as [string[], string] } var input = new stream.PassThrough() var output = new stream.PassThrough() - var rl = readline.createInterface(input, output, completer, true) + var rl = readline.createInterface(input, output, completer as readline.Completer, true) rl.question('a').then(function (answer) { assert.ok(output.read().toString().match(/TESTSTRING/)) @@ -197,7 +197,7 @@ describe('readline', function () { var input = new stream.PassThrough() var output = new stream.PassThrough() - var rl = readline.createInterface(input, output, completer, true ) + var rl = readline.createInterface(input, output, completer as readline.Completer, true ) rl.question('a').then(function (answer) { assert.ok(output.read().toString().match(/TESTSTRING/)) diff --git a/types/nightmare/nightmare-tests.ts b/types/nightmare/nightmare-tests.ts index d49d8b5932..5d6da26d2a 100644 --- a/types/nightmare/nightmare-tests.ts +++ b/types/nightmare/nightmare-tests.ts @@ -17,7 +17,7 @@ new Nightmare() .click('.searchsubmit') .wait('.url.breadcrumb') .evaluate(() => { - return (document.querySelector('.url.breadcrumb')).innerText; + return (document.querySelector('.url.breadcrumb') as HTMLElement).innerText; }, (breadcrumb: string) => { // expect(breadcrumb).to.equal('github.com'); }) @@ -165,7 +165,7 @@ new Nightmare() .goto('http://validator.w3.org/#validate_by_upload') .upload('#uploaded_file', 'test/files/jquery-2.1.1.min.js') .evaluate(function () { - return (document.getElementById('uploaded_file')).value; + return (document.getElementById('uploaded_file') as HTMLInputElement).value; }, function (value) { }) .run(done); @@ -214,7 +214,7 @@ new Nightmare() var seconds = function () { var gifs = document.querySelectorAll('img'); - var split = (gifs[gifs.length - 2]).src.split('.gif')[0]; + var split = (gifs[gifs.length - 2] as HTMLImageElement).src.split('.gif')[0]; var seconds = split.split('.com/c')[1]; return parseInt(seconds, 10); }; @@ -319,7 +319,7 @@ new Nightmare() .headers(headers) .goto('http://httpbin.org/headers') .evaluate(function () { - return (document.body.children[0]).innerHTML; + return (document.body.children[0] as HTMLElement).innerHTML; }, function (data: string) { }) .run(done); diff --git a/types/node-ral/node-ral-tests.ts b/types/node-ral/node-ral-tests.ts index a625c37da4..3c6f6cd9b1 100644 --- a/types/node-ral/node-ral-tests.ts +++ b/types/node-ral/node-ral-tests.ts @@ -17,7 +17,7 @@ class HashringBalance extends nodeRal.Balance { return 'hashring'; } fetchServer(balanceContext: nodeRal.Balance.BalanceContextClass, conf: {}, prevBackend: nodeRal.Server) { - return {}; + return {} as nodeRal.Server; } } diff --git a/types/nw.js/nw.js-tests.ts b/types/nw.js/nw.js-tests.ts index 853feed3b8..b0387f97a4 100644 --- a/types/nw.js/nw.js-tests.ts +++ b/types/nw.js/nw.js-tests.ts @@ -164,7 +164,7 @@ nw.Screen.chooseDesktopMedia( ["window", "screen"], maxWidth: 1920, maxHeight: 1080 }, - optional: [] + optional: [] as any[] }; //navigator.webkitGetUserMedia( { audio: false, video: constraint }, success_func, fallback_func ); } diff --git a/types/pouchdb-core/pouchdb-core-tests.ts b/types/pouchdb-core/pouchdb-core-tests.ts index c4c1e0e408..911a21e2f7 100644 --- a/types/pouchdb-core/pouchdb-core-tests.ts +++ b/types/pouchdb-core/pouchdb-core-tests.ts @@ -50,7 +50,7 @@ function testBulkDocs() { const isError = ( result: PouchDB.Core.Response | PouchDB.Core.Error ): result is PouchDB.Core.Error => { - return !!( result).error; + return !!(result as PouchDB.Core.Error).error; }; db.bulkDocs([model, model2]).then((result) => { diff --git a/types/pouchdb-upsert/pouchdb-upsert-tests.ts b/types/pouchdb-upsert/pouchdb-upsert-tests.ts index be36580bf7..0f718bb033 100644 --- a/types/pouchdb-upsert/pouchdb-upsert-tests.ts +++ b/types/pouchdb-upsert/pouchdb-upsert-tests.ts @@ -15,7 +15,7 @@ function testUpsert_WithPromise_AndReturnDoc() { // `doc` may be empty if the document didn't already exist, so we have to // cast it to the type containing the required fields. If the document type // had all optional fields, the cast would not be necessary. - return doc; + return doc as UpsertDocModel; }).then((res: PouchDB.UpsertResponse) => { }); } @@ -25,7 +25,7 @@ function testUpsert_WithPromise_AndReturnFalsey() { if (doc.readonly) return false; // Make some updates.... - return doc; + return doc as UpsertDocModel; }).then((res: PouchDB.UpsertResponse) => { }); } @@ -41,7 +41,7 @@ function testUpsert_WithPromise_AndReturnNewObject() { function testUpsert_WithCallback_AndReturnDoc() { db.upsert(docToUpsert._id, (doc) => { // Make some updates.... - return doc; + return doc as UpsertDocModel; }, (error: PouchDB.Core.Error, res: PouchDB.UpsertResponse) => {}); } @@ -51,7 +51,7 @@ function testUpsert_WithCallback_AndReturnFalsey() { if (doc.readonly) return false; // Make some updates.... - return doc; + return doc as UpsertDocModel; }, (error: PouchDB.Core.Error, res: PouchDB.UpsertResponse) => {}); } diff --git a/types/project-oxford/project-oxford-tests.ts b/types/project-oxford/project-oxford-tests.ts index d4c59de109..8b1dbec466 100644 --- a/types/project-oxford/project-oxford-tests.ts +++ b/types/project-oxford/project-oxford-tests.ts @@ -12,7 +12,7 @@ const {describe, it, before, after, beforeEach, afterEach} = null as any as { var client = new oxford.Client(process.env.OXFORD_KEY); // Store variables, no point in calling the api too often -var billFaces = []; +var billFaces = [] as string[]; var personGroupId = "uuid.v4()"; var personGroupId2 = "uuid.v4()"; var billPersonId: string; @@ -113,7 +113,7 @@ describe('Project Oxford Face API Test', function () { describe('#grouping()', function () { it('detects groups faces', function (done) { - var faceIds = []; + var faceIds = [] as string[]; this.timeout(10000); diff --git a/types/react/test/index.ts b/types/react/test/index.ts index 9680b8d8cd..de043082fb 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -121,7 +121,7 @@ class ModernComponent extends React.Component hello: PropTypes.string.isRequired, world: PropTypes.string, foo: PropTypes.number.isRequired, - key: > PropTypes.oneOfType([PropTypes.number, PropTypes.string]) + key: PropTypes.oneOfType([PropTypes.number, PropTypes.string]) as PropTypes.Validator }; static contextTypes: React.ValidationMap = { diff --git a/types/restify/restify-tests.ts b/types/restify/restify-tests.ts index 42bbe12524..70ce178df0 100644 --- a/types/restify/restify-tests.ts +++ b/types/restify/restify-tests.ts @@ -175,7 +175,7 @@ server.on('after', (req: restify.Request, res: restify.Response, route: restify. restify.plugins.auditLogger({ event: 'after', log: logger })(req, res, route, err); }); -( restify).defaultResponseHeaders = function(this: restify.Request, data: any) { +(restify as any).defaultResponseHeaders = function(this: restify.Request, data: any) { this.header('Server', 'helloworld'); }; diff --git a/types/restify/v4/restify-tests.ts b/types/restify/v4/restify-tests.ts index 01374a963c..49aead41ab 100644 --- a/types/restify/v4/restify-tests.ts +++ b/types/restify/v4/restify-tests.ts @@ -285,11 +285,11 @@ server.on('after', (req: restify.Request, res: restify.Response, route: restify. restify.auditLogger({ log: () => { } })(req, res, route, err); }); -( restify).defaultResponseHeaders = function(this: restify.Request, data: any) { +(restify as any).defaultResponseHeaders = function(this: restify.Request, data: any) { this.header('Server', 'helloworld'); }; -( restify).defaultResponseHeaders = false; +(restify as any).defaultResponseHeaders = false; // RESTIFY Client Tests diff --git a/types/restify/v5/restify-tests.ts b/types/restify/v5/restify-tests.ts index 8601d912ac..3342183c2f 100644 --- a/types/restify/v5/restify-tests.ts +++ b/types/restify/v5/restify-tests.ts @@ -170,7 +170,7 @@ server.on('after', (req: restify.Request, res: restify.Response, route: restify. restify.plugins.auditLogger({ event: 'after', log: logger })(req, res, route, err); }); -( restify).defaultResponseHeaders = function(this: restify.Request, data: any) { +(restify as any).defaultResponseHeaders = function(this: restify.Request, data: any) { this.header('Server', 'helloworld'); }; diff --git a/types/rx.wamp/rx.wamp-tests.ts b/types/rx.wamp/rx.wamp-tests.ts index 6e7cb3e6ed..741b8e0de9 100644 --- a/types/rx.wamp/rx.wamp-tests.ts +++ b/types/rx.wamp/rx.wamp-tests.ts @@ -137,11 +137,11 @@ function weather_station_monitor(session: autobahn.Session) { //Home control settings var desiredTemperature = Rx.Observable.subscribeAsObservable(session, "temperature.indoors.desired") - .map(x => x.args[0]); + .map(x => x.args[0] as number); var dailyForecast = sensorReadings - .map(rawValue => rawValue.kwargs) + .map(rawValue => rawValue.kwargs as IWeather) .throttle(1000) // At most once every second .bufferWithTime(1000 * 60 * 60 * 24) //Milliseconds in a day .tap(readings => { diff --git a/types/set-cookie-parser/set-cookie-parser-tests.ts b/types/set-cookie-parser/set-cookie-parser-tests.ts index 0faff0148c..ab4e88005d 100644 --- a/types/set-cookie-parser/set-cookie-parser-tests.ts +++ b/types/set-cookie-parser/set-cookie-parser-tests.ts @@ -39,7 +39,7 @@ assert.equal(cookies[1].name, "foo"); assert.equal(cookies[1].value, "bar"); // HTTP response message test -var message = {}; +var message = {} as http.IncomingMessage; message.headers = { "set-cookie": ["bam=baz", "foo=bar"] }; cookies = setCookie(message); assert.equal(cookies.length, 2); diff --git a/types/shelljs/shelljs-tests.ts b/types/shelljs/shelljs-tests.ts index 37dccddff6..b61ddbd3ba 100644 --- a/types/shelljs/shelljs-tests.ts +++ b/types/shelljs/shelljs-tests.ts @@ -82,10 +82,10 @@ import child = require("child_process"); const version = shell.exec("node --version").stdout; -const version2 = shell.exec("node --version", { async: false }); +const version2 = shell.exec("node --version", { async: false }) as shell.ExecOutputReturnValue; const output = version2.stdout; -const asyncVersion3 = shell.exec("node --version", { async: true }); +const asyncVersion3 = shell.exec("node --version", { async: true }) as child.ChildProcess; let pid = asyncVersion3.pid; shell.exec("node --version", { silent: true }, (code, stdout, stderr) => { diff --git a/types/socketio-jwt/socketio-jwt-tests.ts b/types/socketio-jwt/socketio-jwt-tests.ts index 2341de7747..2309d2c8d6 100644 --- a/types/socketio-jwt/socketio-jwt-tests.ts +++ b/types/socketio-jwt/socketio-jwt-tests.ts @@ -27,7 +27,7 @@ io.on('connection', authorize({ io.on('authenticated', (socket: SocketIo.Socket) => { console.log('authenticated!!'); - console.log(JSON.stringify(( socket).anyNameYouWant)); + console.log(JSON.stringify((socket as any).anyNameYouWant)); }); const secrets: any = { diff --git a/types/spdy/spdy-tests.ts b/types/spdy/spdy-tests.ts index cd9ebd034e..6dcce1d28d 100644 --- a/types/spdy/spdy-tests.ts +++ b/types/spdy/spdy-tests.ts @@ -58,7 +58,7 @@ describe('SPDY Client', () => { server.listen(fixtures.port, () => { agent = spdy.createAgent({ rejectUnauthorized: false, - port: fixtures.port, + port: fixtures.port as number, spdy: { plain, protocol: plain ? npn : null, diff --git a/types/swaggerize-express/swaggerize-express-tests.ts b/types/swaggerize-express/swaggerize-express-tests.ts index 46ada50a77..67f8ab49bd 100644 --- a/types/swaggerize-express/swaggerize-express-tests.ts +++ b/types/swaggerize-express/swaggerize-express-tests.ts @@ -15,13 +15,13 @@ const api = { }; var app = express(); -app.use(swaggerize({ +app.use(swaggerize({ api, docspath: '/api-docs', handlers: './handlers' -})); +} as swaggerize.Options)); -app.use(swaggerize({ +app.use(swaggerize({ api, docspath: '/api-docs', handlers: { @@ -33,9 +33,9 @@ app.use(swaggerize({ } } } -})); +} as swaggerize.Options)); -app.use(swaggerize({ +app.use(swaggerize({ api, docspath: '/api-docs', handlers: { @@ -48,9 +48,9 @@ app.use(swaggerize({ } } } -})); +} as swaggerize.Options)); var server = app.listen(18888, 'localhost', function () { const addr = server.address() as AddressInfo; - (app).swagger.api.host = addr.address + ':' + addr.port; + (app as swaggerize.SwaggerizedExpress).swagger.api.host = addr.address + ':' + addr.port; }); diff --git a/types/terminal-menu/terminal-menu-tests.ts b/types/terminal-menu/terminal-menu-tests.ts index 441c644c96..979407be85 100644 --- a/types/terminal-menu/terminal-menu-tests.ts +++ b/types/terminal-menu/terminal-menu-tests.ts @@ -1,6 +1,6 @@ import * as tty from "tty"; // For typing -let stdin = ( process.stdin); +let stdin = (process.stdin as tty.ReadStream); if(!stdin.isTTY) { console.log("Terminal not supported"); diff --git a/types/twilio/twilio-tests.ts b/types/twilio/twilio-tests.ts index 33a691eac0..2e7682d3b2 100644 --- a/types/twilio/twilio-tests.ts +++ b/types/twilio/twilio-tests.ts @@ -240,5 +240,5 @@ twilio.webhook("MYAUTHTOKEN", { validate: false }); function getMockExpressRequest(): Express.Request { - return JSON.parse("{}"); + return JSON.parse("{}") as Express.Request; } diff --git a/types/vinyl-fs/vinyl-fs-tests.ts b/types/vinyl-fs/vinyl-fs-tests.ts index 6cecf42f47..aac3c4f49e 100644 --- a/types/vinyl-fs/vinyl-fs-tests.ts +++ b/types/vinyl-fs/vinyl-fs-tests.ts @@ -383,9 +383,9 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: expectedContents, - stat: { + stat: { mode: expectedMode - } + } as fs.Stats }); const onEnd = () => { @@ -424,9 +424,9 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: contentStream, - stat: { + stat: { mode: expectedMode - } + } as fs.Stats }); const onEnd = () => { @@ -467,10 +467,10 @@ describe('dest stream', () => { cwd: __dirname, path: inputPath, contents: null, - stat: { + stat: { isDirectory: () => true, mode: expectedMode - } + } as fs.Stats }); const onEnd = () => { @@ -711,9 +711,9 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: expectedContents, - stat: { + stat: { mode: expectedMode - } + } as fs.Stats }); const onEnd = () => { @@ -752,9 +752,9 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: contentStream, - stat: { + stat: { mode: expectedMode - } + } as fs.Stats }); const onEnd = () => { @@ -795,10 +795,10 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: null, - stat: { + stat: { isDirectory: () => true, mode: expectedMode - } + } as fs.Stats }); const onEnd = () => { @@ -870,9 +870,9 @@ describe('symlink stream', () => { cwd: __dirname, path: inputPath, contents: expectedContents, - stat: { + stat: { mode: expectedMode - } + } as fs.Stats }); fs.mkdirSync(expectedBase); diff --git a/types/vinyl/v0/vinyl-tests.ts b/types/vinyl/v0/vinyl-tests.ts index 8c7de1ea52..8c4415bb35 100644 --- a/types/vinyl/v0/vinyl-tests.ts +++ b/types/vinyl/v0/vinyl-tests.ts @@ -167,11 +167,11 @@ describe('File', () => { }); describe('isDirectory()', () => { - var fakeStat = { + var fakeStat = { isDirectory() { return true; } - }; + } as fs.Stats; it('should return false when the contents are a Buffer', done => { var val = new Buffer("test"); @@ -216,10 +216,10 @@ describe('File', () => { let fileUtf8Contents = fileContents instanceof Buffer ? fileContents.toString('utf8') : - (fileContents).toString(); + (fileContents as NodeJS.ReadableStream).toString(); let file2Utf8Contents = file2Contents instanceof Buffer ? file2Contents.toString('utf8') : - (file2Contents).toString(); + (file2Contents as NodeJS.ReadableStream).toString(); file2Utf8Contents.should.equal(fileUtf8Contents); done(); diff --git a/types/whatwg-streams/whatwg-streams-tests.ts b/types/whatwg-streams/whatwg-streams-tests.ts index be749686cc..fb5c03e67c 100644 --- a/types/whatwg-streams/whatwg-streams-tests.ts +++ b/types/whatwg-streams/whatwg-streams-tests.ts @@ -149,7 +149,7 @@ function makeReadableFileStream(filename: string) { pull(controller) { const buffer = new ArrayBuffer(CHUNK_SIZE); - return fs.read(fd, buffer, 0, CHUNK_SIZE, position).then(bytesRead => { + return fs.read(fd, buffer as any, 0, CHUNK_SIZE, position).then(bytesRead => { if (bytesRead === 0) { return fs.close(fd).then(() => controller.close()); } else { @@ -189,7 +189,7 @@ function makeReadableByteFileStream(filename: string) { // feature allocates a buffer and passes it to us via byobRequest. const v = controller.byobRequest!.view; - return fs.read(fd, v.buffer, v.byteOffset, v.byteLength, position).then(bytesRead => { + return fs.read(fd, v.buffer as any, v.byteOffset, v.byteLength, position).then(bytesRead => { if (bytesRead === 0) { return fs.close(fd).then(() => controller.close()); } else { diff --git a/types/yog-log/yog-log-tests.ts b/types/yog-log/yog-log-tests.ts index 90dd730cfb..7a37c648f8 100644 --- a/types/yog-log/yog-log-tests.ts +++ b/types/yog-log/yog-log-tests.ts @@ -16,7 +16,7 @@ const cookie_value = log.getCookie('test'); const getLogFile = log.getLogFile(0); const log_format = log.getLogFormat('ACCESS'); -const logid = log.getLogID( {}, 'test'); +const logid = log.getLogID({} as express.Request, 'test'); const intlevel = log.getLogLevelInt('ACCESS'); const prfix = log.getLogPrefix(); const log_str = log.getLogString('test'); diff --git a/types/yog2-kernel/yog2-kernel-tests.ts b/types/yog2-kernel/yog2-kernel-tests.ts index a53b3c4dad..7f88134b10 100644 --- a/types/yog2-kernel/yog2-kernel-tests.ts +++ b/types/yog2-kernel/yog2-kernel-tests.ts @@ -17,8 +17,8 @@ const handler = async function(req: yog2Kernel.Request, resp: yog2Kernel.Respons resp.render("test", {}); }; -const router = {}; -( router.action("test")).get; +const router = {} as yog2Kernel.Router; +(router.action("test") as yog2Kernel.ActionObject).get; const handler1 = router.wrapAsync(function() { }); const handler21 = router.wrapAsync(function(req: yog2Kernel.Request) { });