i can not make basic import of ThrottlerModule. It shows "Object literal may only specify known properties, and 'ttl' does not exist in type 'ThrottlerModuleOptions'.". All what i did is just made import to App module:
import { ThrottlerModule } from '@nestjs/throttler';`
@Module({})
export class AppModule {
public static initialize(): DynamicModule {
return {
module: AppModule,
imports: [
CacheModule.register({
isGlobal: true,
}),
ConfigModule.forRoot({
envFilePath: `.${process.env.NODE_ENV}.env`,
}),
SequelizeModule.forRoot({
// code
}),
ServeStaticModule.forRoot({
rootPath: path.resolve(__dirname, '../../client/build'),
}),
ThrottlerModule.forRoot({
ttl: 60,
limit: 100,
}),
...Modules,
],
controllers: [],
providers: [],
};
}}
What did i do wrong? I saw ttl in 'ThrottlerModuleOptions' file, but no idea why it says that ttl does not exist
Node.js: 16.19.1
Nest.js: 9.4.2
Throttler: 6.2.1
Changed Throttler versions, but maybe i chose wrong one
If you look in the changelog of @nestjs/throttler@5.0.1
you'll read that there were breaking changes for what the configuration of the module looks like. Namely, you need to wrap the options in an array now, because it can handle multiple throttling definitions now