Here: I used VS code as an IDE
The problem was:
let fName:String = "Yokey"; console.log(fName.anchor("url"));
will result in:
PS C:\MYahya\OS_DEV\typescript_lrn\1> tsc main.ts main.ts(2,19): error TS2339: Property 'anchor' does not exist on type 'String'.
Decision:
I have to include the following tsconfig.json file in the project:
{ "compilerOptions": { "module": "commonjs", "target": "es6", "noImplicitAny": true, "strictNullChecks": true, "noImplicitReturns": true, "noImplicitThis": true, "noUnusedLocals": true, "noUnusedParameters": true, "baseUrl": "../types", "typeRoots": [ "../types" ], "types": [], "forceConsistentCasingInFileNames": true, } }
Then I used tsc (without a file name), so the transpiler will use tsconfig.json to transcribe all types of script files located in directories into js files.
source share