This is based on the export =
and import = require()
section in the
modules page of the TypeScript handbook.
> const exportEquals = require('./exportEquals');
undefined
> exportEquals(2)
20
> exportEquals.MARKER
'HELLO'
This is based on the export =
and import = require()
section in the
modules page of the TypeScript handbook.
> const exportEquals = require('./exportEquals');
undefined
> exportEquals(2)
20
> exportEquals.MARKER
'HELLO'
"use strict"; | |
function doMath(value) { | |
return value + 18; | |
} | |
doMath.MARKER = 'HELLO'; // Would rather do `export.MARKER = 'HELLO'`. | |
module.exports = doMath; |
function doMath(value: number): number { | |
return value + 18 | |
} | |
export = doMath | |
doMath.MARKER = 'HELLO' // Would rather do `export.MARKER = 'HELLO'`. |