In my current project, I have a component that checks for specific parameters in a query string and performs certain actions based on their existence. However, every time I try to transpile the code, I encounter errors like:
Error TS2339: Property 'oauth_token' does not exist on type '{ [key: string]: any; }'
The constructor and ngOnInit method of my component are as follows:
constructor (
private router: Router
) {}
ngOnInit() {
if ( this.router.routerState.snapshot.queryParams.hasOwnProperty('oauth_token') ) {
... do stuff here ...
}
}
I would appreciate it if someone could offer advice on how to handle default query string parameters efficiently.