MCPcopy
hub / github.com/ts-essentials/ts-essentials / findTsVersion

Function findTsVersion

scripts/find-ts-version.js:20–33  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

18 * @returns {string | undefined}
19 */
20const findTsVersion = (filename) => {
21 try {
22 const data = fs.readFileSync(filename, "utf8");
23 const lines = data.split("\n").map((line) => line.trim());
24 const typescriptLineIndex = lines.findIndex((line) => FIRST_TYPESCRIPT_LINE.test(line));
25 const matched = lines[typescriptLineIndex + 1].match(TYPESCRIPT_VERSION_LINE);
26 if (matched !== null) {
27 return matched[1];
28 }
29 return undefined;
30 } catch {
31 return undefined;
32 }
33};
34
35module.exports = { findTsVersion };

Callers 2

sync-ts-version.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…