fix(ext/ffi): unexport brand from dts (#28503)

This is technically **BREAKING** as it removes a public API, but the
brand is type-only and the chance of anyone actually relying on this
seems very unlikely.

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
This commit is contained in:
Aapo Alasuutari 2025-04-28 21:54:21 +03:00 committed by GitHub
parent f44329fc56
commit 56282c1d9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run --allow-read --allow-env --allow-sys --config=tests/config/deno.json
// Copyright 2018-2025 the Deno authors. MIT license.
import { Node, Project, ts } from "npm:ts-morph@22.0.0";
import { Node, Project, ts } from "npm:ts-morph@25.0.1";
import { join, ROOT_PATH } from "./util.js";
const libs = [
@ -50,7 +50,7 @@ for (const file of project.getSourceFiles()) {
node.getKind() === ts.SyntaxKind.TypeAliasDeclaration;
if (parent) {
if (!node.isExported()) {
if (!node.isExported() && !isBrandVarStmt(node)) {
errors.push(getMissingErrorPrefix(node) + "export keyword");
continue;
}
@ -87,6 +87,12 @@ if (errors.length > 0) {
throw new AggregateError(errors);
}
function isBrandVarStmt(node) {
// this variable statement is intentionally private
return Node.isVariableStatement(node) &&
node.getDeclarations()[0].getName() === "brand";
}
function getMissingErrorPrefix(node) {
return getErrorPrefix(node) + `is missing a `;
}