Closed
Description
Bug Report
π Search Terms
- factory
- createSourceFile
- typings
π Version & Regression Information
In v4.2.4 (current latest)
β― Playground Link
Playground link with relevant code
π» Code
import { factory as f, SyntaxKind, NodeFlags } from 'typescript'
const comment = f.createJSDocComment('test', [])
const file = f.createSourceFile(
[comment], // Error here as createSourceFile needs a Statement array.
f.createToken(SyntaxKind.EndOfFileToken),
NodeFlags.None
)
π Actual behavior
Compiler error in factory#createSourceFile
when a JSDoc[]
node supplied as Statement[]
is expected. If it's casted to any, its fine at runtime, so I assume it's just an issue with typings.
π Expected behavior
Accept JSDoc as a root level element for factory#createSourceFile