Skip to content

Commit 9dc4bf9

Browse files
BridgeJS: Update object-like check not to rely on definition location
1 parent 7fb636f commit 9dc4bf9

File tree

3 files changed

+0
-41
lines changed

3 files changed

+0
-41
lines changed

Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,6 @@ export class TypeProcessor {
721721
if (typeMap[typeString]) {
722722
return typeMap[typeString];
723723
}
724-
if (isObjectType(type) && isTypeScriptLibSymbol(symbol)) {
725-
return "JSObject";
726-
}
727724
if (symbol && (symbol.flags & ts.SymbolFlags.Enum) !== 0) {
728725
const typeName = symbol.name;
729726
this.seenTypes.set(type, node);
@@ -952,17 +949,6 @@ function isObjectType(type) {
952949
return typeof type.objectFlags === "number";
953950
}
954951

955-
/**
956-
* @param {ts.Symbol | undefined} symbol
957-
* @returns {boolean}
958-
*/
959-
function isTypeScriptLibSymbol(symbol) {
960-
if (!symbol) return false;
961-
const declarations = symbol.getDeclarations() ?? [];
962-
if (!declarations.length) return false;
963-
return declarations.every(decl => decl.getSourceFile().fileName.includes("node_modules/typescript/lib"));
964-
}
965-
966952
/**
967953
*
968954
* @param {ts.Type} type

Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -155,24 +155,6 @@ exports[`ts2swift > snapshots Swift output for ObjectLikeTypes.d.ts > ObjectLike
155155
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
156156
157157
@JSFunction func acceptObject(_ v: JSObject) throws(JSException) -> Void
158-
159-
@JSFunction func acceptFunction(_ v: JSObject) throws(JSException) -> Void
160-
161-
@JSFunction func acceptDate(_ v: JSObject) throws(JSException) -> JSObject
162-
163-
@JSFunction func acceptRegExp(_ v: JSObject) throws(JSException) -> JSObject
164-
165-
@JSFunction func acceptMap(_ v: JSObject) throws(JSException) -> JSObject
166-
167-
@JSFunction func acceptSet(_ v: JSObject) throws(JSException) -> JSObject
168-
169-
@JSFunction func acceptPromiseLike(_ v: JSObject) throws(JSException) -> JSObject
170-
171-
@JSFunction func acceptArrayBuffer(_ v: JSObject) throws(JSException) -> JSObject
172-
173-
@JSFunction func acceptArrayLike(_ v: JSObject) throws(JSException) -> JSObject
174-
175-
@JSFunction func acceptIterable(_ v: JSObject) throws(JSException) -> JSObject
176158
"
177159
`;
178160
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1 @@
11
export function acceptObject(v: object): void;
2-
export function acceptFunction(v: Function): void;
3-
export function acceptDate(v: Date): Date;
4-
export function acceptRegExp(v: RegExp): RegExp;
5-
export function acceptMap(v: Map<string, number>): Map<string, number>;
6-
export function acceptSet(v: Set<string>): Set<string>;
7-
export function acceptPromiseLike(v: PromiseLike<string>): PromiseLike<string>;
8-
export function acceptArrayBuffer(v: ArrayBuffer): ArrayBuffer;
9-
export function acceptArrayLike(v: ArrayLike<string>): ArrayLike<string>;
10-
export function acceptIterable(v: Iterable<string>): Iterable<string>;

0 commit comments

Comments
 (0)