Closed mlncstr closed 4 years ago
That's strange. What's your tsconfig like?
I wonder if moving Config
from an ambient to an exported type would help. I can try tonight.
(Sorry for the delay in responding - I didn't have this repo on my watchlist)
No worries @jbreckmckye - here's our tsconfig
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"allowSyntheticDefaultImports": true,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom",
"es2018.promise"
]
},
"allowJs": true
}
Sorry, I forgot all about this. It's been a hectic couple of months for me. Did you end up fixing this?
all you have todo is take the interface from the typings and add it to the index file where the error is occuring thats how i fixed it atleast
but then it will error out with Uncaught TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
unless i put it in main.ts if i put it in any component.ts it errors with the error above
any help with this would be greatly appreciated
i fixed it so i created the interface for config in the index file where config is exported in the constructor initialized like normal in main then i run the following code in my serve this will prevent the app from opening if not logged in
index.d.ts
interface Config {
applicationName?: string,
// API we're going to access
auth0Audience: string,
auth0ClientId: string,
auth0Domain: string,
// What permissions do we want?
auth0Scopes: string,
useRefreshTokens?: boolean
}
export default class ElectronAuth0Login {
private config;
private tokenProperties;
private useRefreshToken;
constructor(config: Config);
logout(): Promise<void>;
getToken(): Promise<string>;
private sendRefreshToken;
private login;
private getAuthCode;
private exchangeAuthCodeForToken;
}
Main.TS
if (serve) {
require('electron-reload')(__dirname, {
electron: require(`${__dirname}/node_modules/electron`)
});
win.loadURL('http://localhost:3000');
} else {
auth.getToken().then(res => {
if(!res){ return } else {
win.loadURL(url.format({
pathname: path.join(__dirname, 'dist/index.html'),
protocol: 'file:',
slashes: true
}))
}
} )
}
great job btw @jbreckmckye
i know that there is probably a better way of fixing that config issue but it was just on the fly and a quick fix
In the latest version (1.3.0) there are no ambient types, so you shouldn't have this issue any more.
i dont see version 1.3.0 only 1.1.0
On Sun, Feb 9, 2020 at 11:51 AM Jimmy Breck-McKye notifications@github.com wrote:
Closed #6 https://github.com/jbreckmckye/electron-auth0-login/issues/6.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jbreckmckye/electron-auth0-login/issues/6?email_source=notifications&email_token=AIPJNQTFFLQEXH6QGBGFCB3RCAYC5A5CNFSM4IWTAJHKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOWQGJDHI#event-3020722589, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIPJNQTOQCUCQQBEK3IG5DTRCAYC5ANCNFSM4IWTAJHA .
Using Angular 8.2 and Electron 6.0.2
ERROR in ../node_modules/electron-auth0-login/dist/index.d.ts:5:25 - error TS2304: Cannot find name 'Config'.
5 constructor(config: Config);
Any ideas on the typings? Do I need to change something in my Angular config?