Ciro Santilli OurBigBook.com  Sponsor 中国独裁统治 China Dictatorship 新疆改造中心、六四事件、法轮功、郝海东、709大抓捕、2015巴拿马文件 邓家贵、低端人口、西藏骚乱
typescript/functionArgument.ts
// https://cirosantilli.com/typescript

const assert = require('assert')

// You can create function with untyped arguments.
function myfunc(
  myInt
) {
  return `${myInt} abc`
}
assert.strictEqual(myfunc(1), '1 abc')
assert.strictEqual(myfunc('def'), 'def abc')

// But why would you?
function myfunc2(myInt: number) {
  return `${myInt} abc`
}
assert.strictEqual(myfunc2(1), '1 abc')
// Type error.
//assert.strictEqual(myfunc2('def'), 'def abc')