Skip to content

Commit 5808a0e

Browse files
committed
fix: proper type support
1 parent 7108397 commit 5808a0e

File tree

4 files changed

+159
-5596
lines changed

4 files changed

+159
-5596
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"build-lib-android": "./scripts/android-build-n-copy-box2d.sh",
3434
"build-lib-ios": "./scripts/ios-build-n-copy-box2d.sh",
3535
"build-lib": "yarn copy-headers && yarn build-lib-android && yarn build-lib-ios",
36-
"build-js": "bob build && cp src/types.d.ts lib/typescript/types.d.ts",
36+
"build-js": "yarn rimraf lib && bob build",
3737
"prepare": "yarn build-lib && yarn build-js",
3838
"release": "release-it"
3939
},

src/Box2d.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { NativeModules, Platform } from 'react-native';
2-
import type { Box2D } from './types';
2+
import type {
3+
b2BodyDef,
4+
b2FixtureDef,
5+
b2PolygonShape,
6+
b2Vec2,
7+
b2World,
8+
} from './types';
39

410
// global func declaration for JSI functions
511
declare global {
@@ -8,11 +14,11 @@ declare global {
814
var Box2dApi:
915
| undefined
1016
| {
11-
b2Vec2: (xIn: number, yIn: number) => Box2D.Common.Math.b2Vec2;
12-
b2World: (b2Vec2: Box2D.Common.Math.b2Vec2) => Box2D.Dynamics.b2World;
13-
b2BodyDef: () => Box2D.Dynamics.b2BodyDef;
14-
b2PolygonShape: () => Box2D.Collision.Shapes.b2PolygonShape;
15-
b2FixtureDef: () => Box2D.Dynamics.b2FixtureDef;
17+
b2Vec2: (xIn: number, yIn: number) => b2Vec2;
18+
b2World: (vec: b2Vec2) => b2World;
19+
b2BodyDef: () => b2BodyDef;
20+
b2PolygonShape: () => b2PolygonShape;
21+
b2FixtureDef: () => b2FixtureDef;
1622
};
1723
}
1824

0 commit comments

Comments
 (0)