build/lib/monaco-api.ts/getAllTopLevelDeclarations
function getAllTopLevelDeclarations(ts: typeof import('typescript'), sourceFile: ts.SourceFile): TSTopLevelDeclare[] {
	const all: TSTopLevelDeclare[] = [];
	visitTopLevelDeclarations(ts, sourceFile, (node) => {
		if (node.kind === ts.SyntaxKind.InterfaceDeclaration || node.kind === ts.SyntaxKind.ClassDeclaration || node.kind === ts.SyntaxKind.ModuleDeclaration) {
			const interfaceDeclaration = <ts.InterfaceDeclaration>node;
			const triviaStart = interfaceDeclaration.pos;
			const triviaEnd = interfaceDeclaration.name.pos;
			const triviaText = getNodeText(sourceFile, { pos: triviaStart, end: triviaEnd });

			if (triviaText.indexOf('@internal') === -1) {
				all.push(node);
			}
		} else {
			const nodeText = getNodeText(sourceFile, node);
			if (nodeText.indexOf('@internal') === -1) {
				all.push(node);
			}
		}
		return false /*continue*/;
	});
	return all;
}