Skip to content

Commit 8f68981

Browse files
author
Ives van Hoorne
committed
Only load typescript worker *after* typings are loaded
1 parent 7a1e0ea commit 8f68981

File tree

2 files changed

+16
-0
lines changed
  • packages/app/src/app/components

2 files changed

+16
-0
lines changed

packages/app/src/app/components/CodeEditor/Monaco/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,12 @@ class MonacoEditor extends React.Component<Props, State> implements Editor {
806806

807807
fetchDependencyTypings = (dependencies: Object) => {
808808
if (this.typingsFetcherWorker) {
809+
this.monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions(
810+
{
811+
noSemanticValidation: true,
812+
noSyntaxValidation: !this.hasNativeTypescript(),
813+
}
814+
);
809815
this.typingsFetcherWorker.postMessage({ dependencies });
810816
}
811817
};
@@ -872,6 +878,11 @@ class MonacoEditor extends React.Component<Props, State> implements Editor {
872878
this.monaco.languages.typescript.typescriptDefaults._onDidChange.fire(
873879
this.monaco.languages.typescript.typescriptDefaults
874880
);
881+
882+
this.monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
883+
noSemanticValidation: false,
884+
noSyntaxValidation: !this.hasNativeTypescript(),
885+
});
875886
};
876887

877888
createModel = async (

packages/app/src/app/components/Preview/DevTools/Console/Message/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ function getMessage(message) {
7070
if (msgArray.length > 1) {
7171
otherErrorLines = msgArray.slice(1);
7272
}
73+
74+
if (!otherErrorLines) {
75+
return <InnerItem>{message.arguments.join(' ')}</InnerItem>;
76+
}
77+
7378
return (
7479
<InnerItem>
7580
<details>

0 commit comments

Comments
 (0)