Title: Something broken in language server in 2.5 · Issue #16616 · microsoft/TypeScript · GitHub
Open Graph Title: Something broken in language server in 2.5 · Issue #16616 · microsoft/TypeScript
X Title: Something broken in language server in 2.5 · Issue #16616 · microsoft/TypeScript
Description: TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx) Code var ts = require('typescript'); var fs = require('fs'); var files = {}; var rootFileNames = ['1.tsx']; rootFileNames.forEach(fileName => { files[fileName] = { version: 0 }; })...
Open Graph Description: TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx) Code var ts = require('typescript'); var fs = require('fs'); var files = {}; var rootFileNames = ['1.tsx']; rootFileNames.forEach(fileName =...
X Description: TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx) Code var ts = require('typescript'); var fs = require('fs'); var files = {}; var rootFileNames = ['1.tsx']; rootFile...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/16616
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Something broken in language server in 2.5","articleBody":"\u003c!-- BUGS: Please use this template. -->\r\n\u003c!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->\r\n\u003c!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->\r\n\r\n**TypeScript Version:** 2.4.0 / nightly (2.5.0-dev.201xxxxx)\r\n\r\n**Code**\r\n\r\n```js\r\nvar ts = require('typescript');\r\nvar fs = require('fs');\r\nvar files = {};\r\nvar rootFileNames = ['1.tsx'];\r\nrootFileNames.forEach(fileName => {\r\n files[fileName] = { version: 0 };\r\n});\r\n\r\nvar options = {\r\n \"module\": 1,\r\n \"target\": 1,\r\n \"jsx\": 2,\r\n \"configFilePath\": \"tsconfig.json\"\r\n}\r\nvar fileName = rootFileNames[0];\r\nconst servicesHost = {\r\n getScriptFileNames: () => rootFileNames,\r\n getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(),\r\n getScriptSnapshot: (fileName) => {\r\n if (!fs.existsSync(fileName)) {\r\n return undefined;\r\n }\r\n return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString());\r\n },\r\n getCurrentDirectory: () => process.cwd(),\r\n getCompilationSettings: () => options,\r\n getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options),\r\n};\r\n\r\nconst services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry())\r\nvar output = services.getEmitOutput(fileName);\r\nvar diagnostics = services.getCompilerOptionsDiagnostics()\r\n .concat(services.getSyntacticDiagnostics(fileName))\r\n .concat(services.getSemanticDiagnostics(fileName));\r\n\r\nconsole.log(diagnostics);\r\n```\r\n\r\n1.tsx\r\n```ts\r\nimport * as React from 'react';\r\n\u003cdiv className=\"foo\">\u003c/div>\r\n```\r\n\r\n**Expected behavior:**\r\nno error\r\n\r\n**Actual behavior:**\r\n messageText: 'Cannot find module \\'react\\'.',\r\n\r\nIt works with 2.4","author":{"url":"https://github.com/cevek","@type":"Person","name":"cevek"},"datePublished":"2017-06-19T13:21:46Z","url":"https://github.com/microsoft/TypeScript/issues/16616"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:dbc0af86-ac62-2cb3-eed2-0a5c2182bae5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 878A:62283:FBEE99:14EA2BC:6B010980 |
| html-safe-nonce | 61a6a576a94beee7f60b3385fa5f921fd9dd731fb08407f170b209489f21de9f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NzhBOjYyMjgzOkZCRUU5OToxNEVBMkJDOjZCMDEwOTgwIiwidmlzaXRvcl9pZCI6Ijg2NDI2MTY4ODU5ODYyNjU0NzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d3cc864a3f0ccf68ccb8c1c099353eb47cd7195cf4f4dbb4eac8639c02c1411f |
| hovercard-subject-tag | issue:236888840 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/16616/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7e7f2c8301633d5c80585e8bb7a155822d63b923e73f507918a8d8406e4d15eb/microsoft/TypeScript/issues/16616 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7e7f2c8301633d5c80585e8bb7a155822d63b923e73f507918a8d8406e4d15eb/microsoft/TypeScript/issues/16616 |
| og:image:alt | TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx) Code var ts = require('typescript'); var fs = require('fs'); var files = {}; var rootFileNames = ['1.tsx']; rootFileNames.forEach(fileName =... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cevek |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width