PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: sandersn/downlevel-dts (js)

Issue:
Downlevel 'import type' and 'export type'
```diff
- import type {Something} from 'somewhere';
# import {Something} from 'somewhere';
```

Pull request:
Downlevel import type and export type
Fixes #6

Patch:
diff --git a/index.js b/index.js
index c57b69c..a357383 100644
--- a/index.js
+++ b/index.js
@@ -75,6 +75,15 @@ function doTransform(k) {
           n.moduleSpecifier
         )
       ];
+    } else if (ts.isExportDeclaration(n) && n.isTypeOnly) {
+      return ts.createExportDeclaration(
+        n.decorators,
+        n.modifiers,
+        n.exportClause,
+        n.moduleSpecifier
+      );
+    } else if (ts.isImportClause(n) && n.isTypeOnly) {
+      return ts.createImportClause(n.name, n.namedBindings);
     }
     return ts.visitEachChild(n, transform, k);
   };


Test patch:
diff --git a/baselines/ts3.4/src/test.d.ts b/baselines/ts3.4/src/test.d.ts
index a800eaa..4da9559 100644
--- a/baselines/ts3.4/src/test.d.ts
+++ b/baselines/ts3.4/src/test.d.ts
@@ -10,3 +10,4 @@ export namespace N {
         r: boolean;
     }
 }
+export { C as DetectiveComics };
diff --git a/baselines/ts3.4/test.d.ts b/baselines/ts3.4/test.d.ts
index 8a805f7..c06de10 100644
--- a/baselines/ts3.4/test.d.ts
+++ b/baselines/ts3.4/test.d.ts
@@ -10,5 +10,6 @@ export namespace N {
         abstract r: boolean;
     }
 }
-import * as rex_1 from "src/test";
-export { rex_1 as rex } from "src/test";
+import { C as CD } from "./src/test";
+import * as rex_1 from "./src/test";
+export { rex_1 as rex } from "./src/test";
diff --git a/test/src/test.d.ts b/test/src/test.d.ts
index 3cf35d5..93c1def 100644
--- a/test/src/test.d.ts
+++ b/test/src/test.d.ts
@@ -12,3 +12,5 @@ export namespace N {
         set r(value: boolean)
     }
 }
+
+export type { C as DetectiveComics };
diff --git a/test/test.d.ts b/test/test.d.ts
index 271ea8c..c16db72 100644
--- a/test/test.d.ts
+++ b/test/test.d.ts
@@ -12,5 +12,6 @@ export namespace N {
     abstract set r(value: boolean);
   }
 }
+import type { C as CD } from "./src/test";
 
-export * as rex from "src/test";
+export * as rex from "./src/test";
Repository: sindresorhus/execa (js)

Issue:
4.0.1 causes problems with Bluebird
I've gotten an error from Bluebird when using execa at version `4.0.1`:
```
TypeError: this._then is not a function
    at Promise.then (~/.config/yarn/global/node_modules/bluebird/js/release/promise.js:154:17)
    at ChildProcess.then (~/.config/yarn/global/node_modules/execa/lib/promise.js:13:25)
```

This works fine if I downgrade execa to `4.0.0`.

Pull request:
Fix problems with third-party Promise
Fixes #426

Patch:
diff --git a/lib/promise.js b/lib/promise.js
index f85c43a..bd9d523 100644
--- a/lib/promise.js
+++ b/lib/promise.js
@@ -1,8 +1,9 @@
 'use strict';
 
+const nativePromisePrototype = (async () => {})().constructor.prototype;
 const descriptors = ['then', 'catch', 'finally'].map(property => [
 	property,
-	Reflect.getOwnPropertyDescriptor(Promise.prototype, property)
+	Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
 ]);
 
 // The return value is a mixin of `childProcess` and `Promise`


Test patch:
diff --git a/test/override-promise.js b/test/override-promise.js
new file mode 100644
index 0000000..30c2465
--- /dev/null
+++ b/test/override-promise.js
@@ -0,0 +1,20 @@
+import path from 'path';
+import test from 'ava';
+
+process.env.PATH = path.join(__dirname, 'fixtures') + path.delimiter + process.env.PATH;
+
+// Can't use `test.before`, because `ava` needs `Promise`.
+// Can't use `import(…)` either, because `execa` is not an ES Module.
+const nativePromise = Promise;
+global.Promise = class BrokenPromise {
+	then() {
+		throw new Error('error');
+	}
+};
+const execa = require('..');
+global.Promise = nativePromise;
+
+test('should work with third-party Promise', async t => {
+	const {stdout} = await execa('noop', ['foo']);
+	t.is(stdout, 'foo');
+});