I wonder if anyone has tried to similar and whethe...
# sst
r
I wonder if anyone has tried to similar and whether this warrants a breaking change in the SST API when using TypeScript😬 I want to be able to push a set of functions into an array and then do some common stuff to them, for example, adding some common permissions. So I try to define my array like:
const someFunctionList: Function[] = [];
but this gives the linting error
Copy code
Don't use `Function` as a type. The `Function` type accepts any function-like value.
It provides no type safety when calling the function, which can be a common source of bugs.
So what I've done instead is to import Function via an alias
import { Function as SSTFunction } from '@serverless-stack/resources';
and used
const someFunctionList: SSTFunction[] = [];
Has anyone encountered the same and found a different way around it?
t
I typically import star from sst and refer to it as
sst.Function
r
Makes sense, I've conditioned myself to import separate classes everywhere to help make things treeshakeable but that's not really an issue here
t
Yeah same thought process