Skip to content

Commit

Permalink
Ignore duplicate types (#14327)
Browse files Browse the repository at this point in the history
* Ignore duplicate types

* oops
  • Loading branch information
DonJayamanne authored Sep 14, 2023
1 parent 55fe039 commit c2a2d6a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 5 additions & 2 deletions api/proposed.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ fs.readdirSync(path.join(__dirname, '../src')).forEach((file) => {
return true;
}
if (line.startsWith('import ') && line.trim().endsWith(';')) {
proposedApiImports.push(line);
if (!proposedApiImports.includes(line)) {
proposedApiImports.push('// @ts-ignore Ignore Duplicate types');
proposedApiImports.push(line);
}
return false;
}
if (line.startsWith(newModuleDeclaration)) {
Expand All @@ -57,7 +60,7 @@ const newSource = source
.split(/\r?\n/g)
.map((line) => {
if (proposedApiImports.length && line.startsWith('import ') && line.trim().endsWith(';')) {
const newLine = [line, ...proposedApiImports].join(EOL);
const newLine = ['// @ts-ignore Ignore Duplicate types', line, ...proposedApiImports].join(EOL);
proposedApiImports = [];
return newLine;
}
Expand Down
3 changes: 1 addition & 2 deletions src/api.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import type { CancellationToken, ProviderResult, CancellationError } from 'vscode';
import type { Event, Uri } from 'vscode';
import type { CancellationToken, ProviderResult, CancellationError, Event, Uri } from 'vscode';

export interface Jupyter {
/**
Expand Down

0 comments on commit c2a2d6a

Please sign in to comment.