diff --git a/types/passport-steam/index.d.ts b/types/passport-steam/index.d.ts new file mode 100644 index 0000000000..5658623ab3 --- /dev/null +++ b/types/passport-steam/index.d.ts @@ -0,0 +1,67 @@ +// Type definitions for passport-steam 1.0 +// Project: https://github.com/liamcurry/passport-steam +// Definitions by: Gonthier Renaud +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export = passport_steam; + +declare function passport_steam(options: any, validate: any): any; + +declare namespace passport_steam { + // Circular reference from passport_steam + const Strategy: any; + + const version: string; + + namespace prototype { + function authenticate(req: any): any; + + function loadAssociation(fn: any): any; + + function loadDiscoveredInfo(fn: any): any; + + function loadDiscoveredInformation(fn: any): any; + + function saveAssociation(fn: any): any; + + function saveDiscoveredInfo(fn: any): any; + + function saveDiscoveredInformation(fn: any): any; + + namespace authenticate { + const prototype: { + }; + } + + namespace loadAssociation { + const prototype: { + }; + } + + namespace loadDiscoveredInfo { + const prototype: { + }; + } + + namespace loadDiscoveredInformation { + const prototype: { + }; + } + + namespace saveAssociation { + const prototype: { + }; + } + + namespace saveDiscoveredInfo { + const prototype: { + }; + } + + namespace saveDiscoveredInformation { + const prototype: { + }; + } + } +} diff --git a/types/passport-steam/passport-steam-tests.ts b/types/passport-steam/passport-steam-tests.ts new file mode 100644 index 0000000000..8a9965efcc --- /dev/null +++ b/types/passport-steam/passport-steam-tests.ts @@ -0,0 +1,26 @@ +/** + * Created by kzaY on 07/09/2017. + */ +import express = require("express"); +import passport = require('passport'); +import steam = require('passport-steam'); + +// just some test model +let User = { + findOrCreate(id: string, provider: string, callback: (err: any, user: any) => void): void { + callback(null, { username: 'james' }); + } +}; + +passport.use(new steam.Strategy({ + returnURL: process.env.PASSPORT_RETURN_URL, + realm: process.env.PASSPORT_REALM, + apiKey: process.env.PASSPORT_API_KEY, +}, + (identifier: any, profile: any, done: (error: any, user?: any) => void) => { + User.findOrCreate(profile.id, profile.provider, (err, user) => { + if (err) { return done(err); } + done(null, user); + }); + }) +); diff --git a/types/passport-steam/tsconfig.json b/types/passport-steam/tsconfig.json new file mode 100644 index 0000000000..ab34d06c60 --- /dev/null +++ b/types/passport-steam/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "passport-steam-tests.ts" + ] +} diff --git a/types/passport-steam/tslint.json b/types/passport-steam/tslint.json new file mode 100644 index 0000000000..c9a409bbed --- /dev/null +++ b/types/passport-steam/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // This package uses the Function type, and it will take effort to fix. + "ban-types": false + } +}