Specifying type of function parameter to be caller type


Say I have the following types:

type FirstType<T> {
	myFunction: function(objs: [FirstType])

entity type SecondType mixes FirstType<SecondType> schema name STYP

Is there a way that I can specify the input of myFunction to be of the type of whatever is calling it (rather than just FirstType), so that the objs automatically come in as SecondType if we’re calling SecondType.myFunction(...)? I’m facing an issue where my function is unable to take in objects of SecondType when I’m making calls from the UI framework, which is not type system-aware.



You don’t need parametric type in this case:

type FirstType {
	myFunction: function(objs: [mixing FirstType])