Different implementations depending on runtime?

#1

Is it possible to define two different implementations for the same method on a type. such as one implementation that runs on js server and another for js client.

For example

type MyType {
// This will return 5
returnANumber: function(): int js client

// This will return 4
returnANumber: function(): int js server

}

Here I will get 4 if I call MyType.returnANumber() from the server and get a 5 if I call it on client side

0 Likes

#2

Not currently; you can only have a single implementation per language. (You can have implementations in different languages at the same time, but not different implementations in the same language for different runtimes.)

1 Like