Skip to content

Commit 35dc9df

Browse files
fix up/suppress TypeScript errors
1 parent 7db57d7 commit 35dc9df

File tree

16 files changed

+63
-69
lines changed

16 files changed

+63
-69
lines changed

packages/core/lib/index.js

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,12 @@
11
"use strict";
2-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3-
if (k2 === undefined) k2 = k;
4-
var desc = Object.getOwnPropertyDescriptor(m, k);
5-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6-
desc = { enumerable: true, get: function() { return m[k]; } };
7-
}
8-
Object.defineProperty(o, k2, desc);
9-
}) : (function(o, m, k, k2) {
10-
if (k2 === undefined) k2 = k;
11-
o[k2] = m[k];
12-
}));
13-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14-
Object.defineProperty(o, "default", { enumerable: true, value: v });
15-
}) : function(o, v) {
16-
o["default"] = v;
17-
});
18-
var __importStar = (this && this.__importStar) || function (mod) {
19-
if (mod && mod.__esModule) return mod;
20-
var result = {};
21-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22-
__setModuleDefault(result, mod);
23-
return result;
24-
};
25-
var reactPrimitives = __importStar(require("react-primitives"));
26-
module.exports = reactPrimitives;
2+
var ReactPrimitives;
3+
try {
4+
// @ts-ignore
5+
ReactPrimitives = require('react-primitives');
6+
}
7+
catch (err) {
8+
// FIXME: Clean-up experimental stub if react-primitives isn't installed.
9+
// @ts-ignore
10+
ReactPrimitives = require('./Core');
11+
}
12+
module.exports = ReactPrimitives;

packages/core/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-platform/core",
3-
"version": "0.0.2-beta.5",
3+
"version": "0.0.2-beta.6",
44
"description": "Reserved for future use.",
55
"main": "lib/index.js",
66
"sketch": "lib/index.js",
@@ -10,11 +10,9 @@
1010
"clean": "rm -rf lib/",
1111
"build:main": "tsc -p tsconfig.json",
1212
"build:module": "tsc -p tsconfig.module.json",
13-
"build:main:types": "tsc -d -p tsconfig.json",
14-
"build:module:types": "tsc -d -p tsconfig.module.json",
15-
"build:js": "npm run build:main",
16-
"build:types": "npm run build:main:types && npm run build:module:types",
17-
"build": "npm run clean && npm run build:js && npm run build:main:types",
13+
"build:js": "npm run build:main # injection doesn’t support ESM && npm run build:module",
14+
"build:types": "tsc -d -p tsconfig.json",
15+
"build": "npm run clean && npm run build:js && npm run build:types",
1816
"dev": "tsc --watch -p tsconfig.json & tsc --watch -d -p tsconfig.json",
1917
"test": "echo \"Error: no test specified\" && exit 1"
2018
},

packages/native/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/native/package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
{
22
"name": "@react-platform/native",
3-
"version": "0.0.3-beta.3",
3+
"version": "0.0.3-beta.4",
44
"description": "Common React Native APIs and components for web and React Native platforms such as `react-native`, `react-native-windows`, `react-native-macos`, `react-sketchapp`, `react-figma`, etc.",
55
"main": "lib/index.js",
6-
"sketch": "lib/module/index.js",
7-
"module": "lib/module/index.js",
8-
"types": "lib/module/index.d.ts",
6+
"sketch": "lib/index.js",
7+
"###module": "lib/module/index.js",
8+
"types": "lib/index.d.ts",
99
"scripts": {
1010
"clean": "rm -rf lib/",
1111
"build:main": "tsc -p tsconfig.json",
1212
"build:module": "tsc -p tsconfig.module.json",
13-
"build:main:types": "tsc -d -p tsconfig.json",
14-
"build:module:types": "tsc -d -p tsconfig.module.json",
15-
"build:js": "npm run build:main && npm run build:module",
16-
"build:types": "npm run build:main:types && npm run build:module:types",
17-
"build": "npm run clean && npm run build:js && npm run build:main:types && npm run build:module:types",
13+
"build:types": "tsc -d -p tsconfig.json",
14+
"build:js": "npm run build:main # injection doesn’t support ESM && npm run build:module",
15+
"build": "npm run clean && npm run build:js && npm run build:types",
1816
"test": "echo \"Error: no test specified\" && exit 1"
1917
},
2018
"repository": {
@@ -29,7 +27,7 @@
2927
"author": "Macintosh Helper <[email protected]>",
3028
"license": "MIT",
3129
"devDependencies": {
32-
"@react-platform/core": "0.0.2-beta.5",
30+
"@react-platform/core": "0.0.2-beta.6",
3331
"@types/react": "^17.0.39",
3432
"@types/react-native": "^0.67.2",
3533
"typescript": "^4.6.2"

packages/native/src/Core.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ interface CoreType extends Modules {
1111
import KeyboardAvoidingView from './modules/KeyboardAvoidingView';
1212
import ScrollView from './modules/ScrollView';
1313
import SafeAreaView from './modules/SafeAreaView';
14+
import AccessibilityInfo from './modules/AccessibilityInfo';
15+
import Button from './modules/Button';
16+
import FlatList from './modules/FlatList';
17+
import ActivityIndicator from './modules/ActivityIndicator';
1418

1519
const Core: CoreType = {
1620
// React Native API – https://github.com/facebook/react-native/blob/6de3fffc37af9b301b669ba183a7910bcc432b6e/index.js
17-
AccessibilityInfo: require('./modules/AccessibilityInfo'),
18-
ActivityIndicator: require('./modules/ActivityIndicator'),
19-
Button: require('./modules/Button'),
21+
AccessibilityInfo,
22+
ActivityIndicator,
23+
Button,
2024
DatePickerIOS: null,
2125
DrawerLayoutAndroid: null,
22-
FlatList: require('./modules/FlatList'),
26+
FlatList,
2327
Image: null,
2428
ImageBackground: null,
2529
InputAccessoryView: null,
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
module.exports = {
2-
isBoldTextEnabled: () => {},
3-
isGrayscaleEnabled: () => {},
4-
isInvertColorsEnabled: () => {},
5-
isReduceMotionEnabled: () => {},
6-
isReduceTransparencyEnabled: () => {},
7-
isScreenReaderEnabled: () => {},
8-
addEventListener: () => {},
9-
setAccessibilityFocus: () => {},
10-
announceForAccessibility: () => {},
11-
removeEventListener: () => {},
12-
};
1+
export const isBoldTextEnabled = () => {};
2+
export const isGrayscaleEnabled = () => {};
3+
export const isInvertColorsEnabled = () => {};
4+
export const isReduceMotionEnabled = () => {};
5+
export const isReduceTransparencyEnabled = () => {};
6+
export const isScreenReaderEnabled = () => {};
7+
export const addEventListener = () => {};
8+
export const setAccessibilityFocus = () => {};
9+
export const announceForAccessibility = () => {};
10+
export const removeEventListener = () => {};
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// @ts-ignore
22
import { Platform } from '@react-platform/core';
33

4-
module.exports = Platform.select({
4+
const AccessibilityInfo = Platform.select({ // @ts-ignore
55
native: () => require('react-native').AccessibilityInfo,
66
web: () => require('react-native-web').AccessibilityInfo,
77
default: () => require('./core'),
88
})();
9+
10+
export default AccessibilityInfo;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = {};
1+
export default {}; // FIXME: Cross-platform stub
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// @ts-ignore
22
import { Platform } from '@react-platform/core';
33

4-
module.exports = Platform.select({
4+
const ActivityIndicator = Platform.select({ // @ts-ignore
55
native: () => require('react-native').ActivityIndicator,
66
web: () => require('react-native-web').ActivityIndicator,
77
default: () => require('./core'),
88
})();
9+
10+
export default ActivityIndicator;

packages/native/src/modules/Button/core.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// @ts-nocheck FIXME: Add types
2+
13
/*
24
* This file contains source-code copied from https://github.com/facebook/react-native/blob/master/Libraries/Components/Button.js
35
* React Native's source code is licensed under the MIT license: https://github.com/facebook/react-native/blob/master/LICENSE
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// @ts-ignore
22
import { Platform } from '@react-platform/core';
33

4-
module.exports = Platform.select({
4+
const Button = Platform.select({ // @ts-ignore
55
native: () => require('react-native').Button,
66
web: () => require('react-native-web').Button,
77
default: () => require('./core'),
88
})();
9+
10+
export default Button;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// @ts-ignore
22
import { Platform } from '@react-platform/core';
33

4-
module.exports = Platform.select({
4+
const FlatList = Platform.select({ // @ts-ignore
55
native: () => require('react-native').FlatList,
66
web: () => require('react-native-web').FlatList,
77
default: () => require('./core'),
88
})();
9+
10+
export default FlatList;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './core';
1+
export { default } from './core';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = {};
1+
export default {};

packages/native/src/modules/PixelRatio/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @ts-ignore
22
import { Platform } from '@react-platform/core';
33

4-
export default Platform.select({
4+
export default Platform.select({ // @ts-ignore
55
native: () => require('react-native').PixelRatio,
66
web: () => require('react-native-web').PixelRatio,
77
default: () => require('./core'),

0 commit comments

Comments
 (0)