是否可以在网页中嵌入TypeScript代码?我想在脚本标记中嵌入TypeScript代码,就像这样(以便它自动编译为Javascript):
<script type = "text/typescript">
//TypeScript code goes here
</script>
Run Code Online (Sandbox Code Playgroud) 在代码示例(catcoding)中,支持 webview 逻辑被编写为 JavaScript 中的匿名函数,但我想在 Typescript 中构建此支持逻辑。
\n\n我厌倦了用 requireJS 将这个逻辑重现为打字稿包,但我无法让它工作。
\n\n// This script will be run within the webview itself\n// It cannot access the main VS Code APIs directly.\n(function () {\n const vscode = acquireVsCodeApi();\n\n\xe2\x80\xa6\n\n}();\nRun Code Online (Sandbox Code Playgroud)\n\n我希望在 TypeScript 中构建这个支持 WebView 逻辑,以便获得静态类型检查。
\n