Skip to content

Commit 1bfcb18

Browse files
authored
build(firestore): remove declare statements from Console types (#9895)
1 parent 89ab3f3 commit 1bfcb18

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

packages/firestore/scripts/build-console-ui-types.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ for (let i = 0; i < args.length; i++) {
4747
}
4848

4949
if (!sourceDtsPath || !destTxtPath) {
50-
console.error('Error: Missing required arguments.');
50+
console.error('Error: Missing required arguments.');
5151
console.error(
5252
'Usage: ts-node build-console-ui-types.ts --input <path/to/pipelines.d.ts> --output <path/to/output.txt>'
5353
);
5454
process.exit(1);
5555
}
5656

5757
if (!fs.existsSync(sourceDtsPath)) {
58-
console.error(`Error: Source file not found: ${sourceDtsPath}`);
58+
console.error(`Error: Source file not found: ${sourceDtsPath}`);
5959
process.exit(1);
6060
}
6161

@@ -89,7 +89,7 @@ interface Firestore {
8989
/**
9090
* @type {Firestore}
9191
*/
92-
declare var db: Firestore;
92+
var db: Firestore;
9393
9494
/**
9595
* Not supported in the query editor.
@@ -109,7 +109,7 @@ type DocumentReference = never;
109109
* Create a \`FieldPath\` by providing field names. If more than one field
110110
* name is provided, the path will point to a nested field in a document.
111111
*/
112-
declare class FieldPath {
112+
class FieldPath {
113113
/**
114114
* Creates a \`FieldPath\` from the provided field names. If more than one field
115115
* name is provided, the path will point to a nested field in a document.
@@ -133,15 +133,15 @@ declare class FieldPath {
133133
*
134134
* @returns A new \`VectorValue\` constructed with a copy of the given array of numbers.
135135
*/
136-
declare function vector(values?: number[]): VectorValue;
136+
function vector(values?: number[]): VectorValue;
137137
138138
/**
139139
* Represents a vector type in Firestore documents.
140140
* Create an instance with <code>{@link vector}</code>.
141141
*
142142
* @class VectorValue
143143
*/
144-
declare class VectorValue {
144+
class VectorValue {
145145
/**
146146
* Returns a copy of the raw number array form of the vector.
147147
*/
@@ -169,7 +169,7 @@ declare class VectorValue {
169169
/**
170170
* An immutable object representing an array of bytes.
171171
*/
172-
declare class Bytes {
172+
class Bytes {
173173
private constructor();
174174
/**
175175
* Creates a new \`Bytes\` object from the given Base64 string, converting it to
@@ -239,7 +239,7 @@ declare class Bytes {
239239
* For examples and further specifications, refer to the
240240
* {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
241241
*/
242-
declare class Timestamp {
242+
class Timestamp {
243243
/**
244244
* The number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
245245
*/
@@ -343,7 +343,7 @@ declare class Timestamp {
343343
* Latitude values are in the range of [-90, 90].
344344
* Longitude values are in the range of [-180, 180].
345345
*/
346-
declare class GeoPoint {
346+
class GeoPoint {
347347
/**
348348
* Creates a new immutable \`GeoPoint\` object with the provided latitude and
349349
* longitude values.
@@ -405,7 +405,7 @@ dtsContent = dtsContent.replace(/^export\s+\{[\s\S]*?\};?\s*$/gm, '');
405405
// Strip 'export ' modifiers from the beginning of lines.
406406
// This converts 'export declare class' -> 'declare class', which is standard
407407
// for ambient global declaration files.
408-
dtsContent = dtsContent.replace(/^\s*export\s+/gm, '');
408+
dtsContent = dtsContent.replace(/^\s*((export|declare)\s+)+/gm, '');
409409

410410
const finalContent: string = HEADER + '\n' + dtsContent;
411411

@@ -473,4 +473,4 @@ if (diagnostics.length > 0) {
473473

474474
// Write output
475475
fs.writeFileSync(destTxtPath, finalContent);
476-
console.log(`Successfully generated and verified console UI types at ${destTxtPath}`);
476+
console.log(`Successfully generated and verified console UI types at ${destTxtPath}`);

0 commit comments

Comments
 (0)