var exec = require('child_process') // exec type is any import ch from 'child_process'; // ch type is child process
Why i am getting this difference in typescript project
Which one should prefer to use in the project
import is a TypeScript feature and TypeScript knows how it works and how to read types from modules that are loaded with it.
import
require is a CommonJS feature and none of the above applies.
require