TypeScript var vs import -


in typescript, difference between

 import http = require('http'); 

and

 var http = require('http'); 

i seeing both ways being used in code source, interchangeable?

your import statement typescript , not run as-is in node. need compile (transpile?) javascript first. can read typescript docs more info how typescript import keyword works. see "going external" section of modules doc.

there import keyword in javascript too, doesn't work way typescript's import works. work in versions of node support es6 modules. there differences between import , require can read @ "es6 modules: final syntax". import can compare/contrast require not var.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -