Skip to content

Using the Flow with stamps #25

@danielkcz

Description

@danielkcz

I am really curious what could be done about this to make the whole experience less painful. I am still rather a rookie user of the Flow so it's possible I am just missing some obvious path. Let's consider some very basic stamp like this.

const SomeStamp = stampit.compose({
  methods: {
    usefulMethod(input: string): string {
      return input.toLowercase()
    }
  }
})

It would be really lovely to be able to extract type definition out of this so I can do the following and know that passed object is really an instance of that stamp and I can safely use its method without checking manually.

function(proxy: SomeStamp) {
  proxy.usefulMethod('BOOM')
}

Right now to achieve something like that I have to essentially duplicate all signatures to a separate interface type.

interface SomeStamp {
    usefulMethod(input: string): string
}

However, that's rather tedious and not that useful in the end. I am aware that C++ has header files that are kinda similar, but there is at least a compiler that can scream when something is out of sync.

Any ideas what about can be done about this? I am certain it would bring stamps to another level of existence. It gets even more powerful with composing a multiple number of small stamps together.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions