How to use the monaco-editor.languages.typescript function in monaco-editor

To help you get started, we’ve selected a few monaco-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Leko / type-puzzle / packages / playground / src / playground.tsx View on Github external
import(
    /* webpackChunkName: "NpmSearchDialog" */ "./components/NpmSearchDialog"
  )
);
const DependencyList = lazy(() =>
  import(/* webpackChunkName: "DependencyList" */ "./components/DependencyList")
);
const TSConfigEditor = lazy(() =>
  import(/* webpackChunkName: "TSConfigEditor" */ "./components/TSConfigEditor")
);
const CodeEditor = lazy(() =>
  import(/* webpackChunkName: "CodeEditor" */ "./components/CodeEditor")
);

const resolver = new Resolver();
const installer = new Installer(languages.typescript.typescriptDefaults);

export function Playground() {
  const [
    primaryEditor,
    setPrimaryEditor
  ] = useState(null);
  const [code, setCode] = useState("");
  const [compilerOptionsStr, setCompilerOptionsStr] = useState("");
  const [compilerOptions, setCompilerOptions] = useState({});
  const [sharableConfig, setSharableConfig] = useState("");
  const [showDialog, setShowDialog] = useState(false);
  const { loading, error, objects, setQuery } = useNpmSearch();
  const { dependencies, append, remove } = useNpmInstall();

  const handleChangeTSConfig = useCallback((tsconfig: string) => {
    setCompilerOptionsStr(tsconfig);
github Leko / type-puzzle / packages / playground / src / playground.tsx View on Github external
const handleChangeTSConfig = useCallback((tsconfig: string) => {
    setCompilerOptionsStr(tsconfig);
    const { config, error } = parseConfigFileTextToJson(
      "tsconfig.json",
      tsconfig
    );
    if (error) {
      console.error(error);
      return;
    }
    setCompilerOptions(config.compilerOptions);
    languages.typescript.typescriptDefaults.setCompilerOptions(
      config.compilerOptions
    );
  }, []);
  const handleUninstall = useCallback(
github contiamo / operational-ui / styleguide / ReactExample.tsx View on Github external
render() {
    const { code, compilerConfig, onError } = this.props
    const compiledCode = compileCode(
      transpile(code, {
        target: languages.typescript.ScriptTarget.ESNext,
        allowNonTsExtensions: true,
        jsx: languages.typescript.JsxEmit.React,
        noEmit: true,
      }),
      compilerConfig,
      onError,
    )

    if (!compiledCode) {
      return null
    }

    const { head, example } = splitExampleCode(compiledCode)
    const initialState = this.getExampleInitialState(head)
    const exampleComponent = this.getExampleComponent(example)
    const wrappedComponent = (
github contiamo / operational-ui / styleguide / compilerOptions.ts View on Github external
import { languages } from "monaco-editor"

export default {
  target: languages.typescript.ScriptTarget.ESNext,
  allowNonTsExtensions: true,
  allowSyntheticDefaultImports: true,
  esModuleInterop: true,
  jsx: languages.typescript.JsxEmit.React,
  moduleResolution: languages.typescript.ModuleResolutionKind.NodeJs,
  module: languages.typescript.ModuleKind.CommonJS,
  noEmit: true,
}
github contiamo / operational-ui / styleguide / compilerOptions.ts View on Github external
import { languages } from "monaco-editor"

export default {
  target: languages.typescript.ScriptTarget.ESNext,
  allowNonTsExtensions: true,
  allowSyntheticDefaultImports: true,
  esModuleInterop: true,
  jsx: languages.typescript.JsxEmit.React,
  moduleResolution: languages.typescript.ModuleResolutionKind.NodeJs,
  module: languages.typescript.ModuleKind.CommonJS,
  noEmit: true,
}
github contiamo / operational-ui / styleguide / ReactExample.tsx View on Github external
render() {
    const { code, compilerConfig, onError } = this.props
    const compiledCode = compileCode(
      transpile(code, {
        target: languages.typescript.ScriptTarget.ESNext,
        allowNonTsExtensions: true,
        jsx: languages.typescript.JsxEmit.React,
        noEmit: true,
      }),
      compilerConfig,
      onError,
    )

    if (!compiledCode) {
      return null
    }

    const { head, example } = splitExampleCode(compiledCode)
    const initialState = this.getExampleInitialState(head)
    const exampleComponent = this.getExampleComponent(example)
    const wrappedComponent = (