How do I manage/control the nesting of TypeScript files in Visual Studio?
I am getting a mix of nested & not nested files, I'm not sure how/why, as shown below.
A JavaScript library has already been developed for this purpose - it's called TypeScript Compile, and it allows typescript to be embedded in HTML (as shown above.)
TypeScript is a superset that needs to compile to plain JavaScript. It offers more control over your code since it uses type annotations, interfaces, classes, and static type checking to throw errors at compile-time. TypeScript helps to enhance code quality and understandability, especially with a large codebase.
You can't use TypeScript directly in a web page the same way you'd be able to use JavaScript -- that is, you can't add a <script> tag and point directly at a TypeScript file as your src, nor can you enter TypeScript between script tags. TypeScript has to be compiled into JavaScript for a web browser to understand it.
You need to arrange things so the function is in scope and then you can just call it with {{getConfigurations(param)}} but people can't give you proper help without more info.
The default for JavaScript files in a TypeScript project is to exclude them rather than nest them - but there are several ways you can nest them if you prefer.
You can hack the registry... or hand-crank your project file's XML... but the easier option is to let Mads Kristensen do it for you with his File Nesting Extension.
You right-click on the .js
file and select "Nest File". It will then show a dialog for you to choose the file to nest under (and usually guesses the right answer).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With