dsherret/ts-ast-viewer

Uncaught Error: Debug Failure. Unexpected node.

Gerrit0 opened this issue · 2 comments

Reproduction:

Paste this into the viewer:

'use strict'

const fs = require('fs')
const os = require('os')
const path = require('path')
const nanoid = require('nanoid')

/**
 * Temporary folder
 *
 * @param {(d: string) => string} transform - Transform function to add prefixes or sufixes to the unique id
 * @returns {string} - Full real path to a temporary folder
 */
const tempdir = (transform = d => d) => {
  const osTmpDir = fs.realpathSync(os.tmpdir())
  return path.join(osTmpDir, transform(nanoid()))
}

module.exports = {
  tempdir
}

Hit CTRL+A to select all
Error shows up in the console
image

Might have time to look at this this weekend, but wanted to document it when I noticed it.

Same problem happens in the typescript playground: https://www.typescriptlang.org/play/

I'll close this in favor of microsoft/TypeScript-Website#462, I spent a bit of time trying to figure out where it's coming from but would probably need a few hours of digging... Orta actually understands this stuff so I'll leave it to him :)