I am trying to make a typescript definitions file for the package passport-twitchtv but am unable to seem to get it to find the definition.
Example definition file:
/// <reference types="passport"/>
import passport = require('passport');
import express = require('express');
interface Profile extends passport.Profile {
id: string;
username: string;
displayName: string;
email: string;
_raw: string;
_json: any;
}
interface IStrategyOptionBase {
clientID: string;
clientSecret: string;
callbackURL: string;
scope: string;
}
interface IStrategyOption extends IStrategyOptionBase {
passReqToCallback?: false;
}
interface IStrategyOptionWithRequest extends IStrategyOptionBase {
passReqToCallback: true;
}
declare class Strategy extends passport.Strategy {
constructor(options: IStrategyOption,
verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void);
constructor(options: IStrategyOptionWithRequest,
verify: (req: express.Request, accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void);
name: string;
authenticate(req: express.Request, options?: Object): void;
}
Import method:
import { Strategy as TwitchStrategy } from 'passport-twitchtv';
I am getting the error: "Could not find a declaration file for module 'passport-twitchtv'".
If I drop the file in my node_modules/@types/passport-twitchtv it works, but I am unable to get typescript to find the .d.ts file otherwise.
I've tried adding a typeRoots to the compilerOptions in tsconfig.json, adding a typings.json file, adding "typings": "./typings/index" to the package file. Nothing I try seems to be working.
Not sure if I am supposed to declare the module when not in the node_modules/@types folder or not.