I have a third party piece of code that is defined as this
export const Actions = {
findByIdAccessTokens: class implements Action {
public readonly type = UserActionTypes.FIND_BY_ID_ACCESSTOKENS;
public payload: { id: any; fk: any; customHeaders };
constructor(
id: any,
fk: any,
customHeaders?: Function,
public meta?: any
) {
this.payload = { id, fk, customHeaders };
}
},
}
in my code I want to pass in a parameter that has a type of findByIdAccessTokens
however, I can't seem to find a way of being able to tell the compiler that my parameter is of that type
so, for example
import { Actions,ActionTypes } from '@base/sdk/actions';
...
filter((action:Actions.findByIdAccessTokens) =>
gives the error [ts] Cannot find namespace 'Actions'.
I've tried every combination that I can think if, and unfortunately my google search terms are so generic (class, typed, etc) that I cannot find any article that solves the problem
I know if I define and export a class
export class findByIdAccessTokens implements Action {
public readonly type = UserActionTypes.FIND_BY_ID_ACCESSTOKENS;
public payload: { id: any; fk: any; customHeaders };
constructor(
id: any,
fk: any,
customHeaders?: Function,
public meta?: any
) {
this.payload = { id, fk, customHeaders };
}
},
and import that directly, then
import { updateByIdAccessTokensSuccess } from '@base/sdk/actions';
...
filter((action:findByIdAccessTokens) =>
compiles just fine (along with the type safety)