import { __awaiter } from "tslib";
import { languages } from 'monaco-editor';
import { LanguageModel } from './languageModel';
/**
 * Typescript language model for code editor
 * @param initialValue - Initial value to be used as initial code
 */
export const TypescriptLanguageModel = (initialValue) => new LanguageModel('typescript', 'ts', (editor) => __awaiter(void 0, void 0, void 0, function* () {
    var _a;
    const uri = (_a = editor.getModel()) === null || _a === void 0 ? void 0 : _a.uri;
    if (!uri) {
        return '';
    }
    const worker = yield languages.typescript.getTypeScriptWorker();
    const client = yield worker(uri);
    const result = yield client.getEmitOutput(uri.toString());
    return result.outputFiles[0].text;
}), initialValue);
//# sourceMappingURL=typescriptLanguageModel.js.map