()
| 8 | } |
| 9 | |
| 10 | export async function getTypescriptVersion(): Promise<string> { |
| 11 | try { |
| 12 | // On node.js this will import the project defined typescript package. |
| 13 | // On bun this will import the bun bundled typescript package. |
| 14 | return (await import('typescript')).default.version |
| 15 | } catch (_) { |
| 16 | // On deno the dynamic import of typescript will fail but typescript is natively available and its version is available in process.versions. |
| 17 | // If none of this worked typescript is likely not installed / available. |
| 18 | return (await getProcessObject())?.versions.typescript || 'unknown' |
| 19 | } |
| 20 | } |
no test coverage detected