You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the title says, the createApp function returns type any which creates bunch of problems
Would it be possible to type it? if not, what's the best approach on a simple index.ts file:
import'source-map-support/register';// 3pimport{Config,createApp,getHttpLogParamsDefault,Logger,ServiceManager}from'@foal/core';// Appimport{AppController}from'./app/app.controller';import{dataSource}from'./db';import{getTraceInfo}from'@myapp/server-logger';asyncfunctionmain(){awaitdataSource.initialize();constserviceManager=newServiceManager();constlogger=serviceManager.get(Logger);constapp=awaitcreateApp(AppController,{
serviceManager,getHttpLogParams: (tokens,req,res)=>{consttraceInfo=getTraceInfo();return{ ...getHttpLogParamsDefault(tokens,req,res), ...traceInfo};}});constport=Config.get('port','number',3001);app.listen(port,()=>logger.info(`Listening on port ${port}...`));}main().catch(err=>{console.error(err.stack);process.exit(1);});
The text was updated successfully, but these errors were encountered:
As the title says, the createApp function returns type any which creates bunch of problems
In the past, the value returned by createApp was typed using @types/express. This unfortunately caused a lot of problems, as this type package is really unstable between two versions. This led to the application not compiling because some Express middleware used one specific version of @types/express while Foal used another. This is why it was originally removed.
if not, what's the best approach on a simple index.ts file:
If you still want to type it, I think the easiest war is probably to install manually @types/express and use the proper type with as MyType when using createApp.
Hello,
As the title says, the createApp function returns type
any
which creates bunch of problemsWould it be possible to type it? if not, what's the best approach on a simple index.ts file:
The text was updated successfully, but these errors were encountered: