## 事象 [[🎮TypeScript Playground]]を開いて以下のコードを記述。 ```ts console.log("hogehoge") ``` 実行しても右側の`Logs`に何も表示されない。[[🎮TypeScript Playground]]上はエラーにはなっていない。(正常終了に見える) [[Chrome devtools]]のconsoleには以下のような出力がされている。 ```console [Compiler] Set compiler options: {strict: true, noImplicitAny: true, strictNullChecks: true, strictFunctionTypes: true, strictPropertyInitialization: true, …} index.ts:636 Using TypeScript 5.2.2 index.ts:638 Available globals: index.ts:639 window.ts {…} index.ts:640 window.sandbox {config: {…}, supportedVersions: Array(24), editor: e.StandaloneEditor, language: 'typescript', monaco: {…}, …} index.ts:641 window.playground {exporter: {…}, ui: {…}, plugins: Array(5), registerPlugin: ƒ, getCurrentPlugin: ƒ, …} index.ts:642 window.react {Children: {…}, Fragment: Symbol(react.fragment), Profiler: Symbol(react.profiler), Component: ƒ, PureComponent: ƒ, …} index.ts:643 window.reactDOM {__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {…}, createPortal: ƒ, findDOMNode: ƒ, flushSync: ƒ, hydrate: ƒ, …} standaloneServices.ts:243 TypeError: window.i is not a function at localize (localizeWithFallback.ts:4:26) at Object.willMount (runtime.ts:92:39) at activatePlugin (createElements.ts:250:32) at runButton.onclick (index.ts:449:21) at Object.run (index.ts:439:53) at B (standaloneCodeEditor.ts:332:39) at t.invokeFunction (instantiationService.ts:68:11) at e.StandaloneCommandService.executeCommand (standaloneServices.ts:285:61) at e.StandaloneKeybindingService._doDispatch (abstractKeybindingService.ts:327:28) at e.StandaloneKeybindingService._dispatch (abstractKeybindingService.ts:184:15) ``` シークレットモードでは再現しないが、[[Chrome devtools]]を開いた状態でリロードすると、シークレットモードでも再現する。 ## 原因 #todo 不明 ## 解決方法 回避策として[[Chrome devtools]]を使わずにシークレットモードで実行する。 根本対策は以下のIssueをウォッチする必要あり。 <div class="link-card"> <div class="link-card-header"> <img src="https://github.githubassets.com/favicons/favicon.svg" class="link-card-site-icon"/> <span class="link-card-site-name">GitHub</span> </div> <div class="link-card-body"> <div class="link-card-content"> <div> <p class="link-card-title">Playground: Unable to run code - TypeError: window.i is not a function · Issue #2925 · microsoft/TypeScript-Website</p> </div> <div class="link-card-description"> Page URL: https://www.typescriptlang.org/play Issue: Clicking 'Run' errors with localizeWithFallback... </div> </div> <img src="https://opengraph.githubassets.com/fc1fc5854c14b0b9848b3bb8ea97a5f07c1eb8cf08a6b54518b68b299d552a51/microsoft/TypeScript-Website/issues/2925" class="link-card-image" /> </div> <a href="https://github.com/microsoft/TypeScript-Website/issues/2925"></a> </div> ## 参考 - [Playground: Unable to run code \- TypeError: window\.i is not a function · Issue \#2925 · microsoft/TypeScript\-Website](https://github.com/microsoft/TypeScript-Website/issues/2925)