Closed
Description
I would like to extend Function
and this compiles fine
interface Function {
hello(): any
}
Function.prototype.hello = function() {
console.log('hello world')
}
function noop() {}
noop.hello() //==> 'hello world' in the console
However, as soon as I try to add an import statement, say
import { sayHello } from './Anything'
where Anything
only contains
export function sayHello() { console.log('hello')}
The compilation fails on Function.protoype.hello
with the message error TS2339: Property 'hello' does not exist on type 'Function'
Why ?
Note1: the compilation fails with tsc options set to either --target es5 --module commonjs
or --target es6
Note2: my final goal is to export utilities in a library to be able to write code like myfunc.liftM(myMonad1, MyMonad2)
or myfunc1.compose(myfunc2)
, etc...
Metadata
Metadata
Assignees
Labels
No labels