Skip to content

Commit 22e39cf

Browse files
committed
docs: Remove type checker references.
1 parent eb45f74 commit 22e39cf

File tree

3 files changed

+2
-56
lines changed

3 files changed

+2
-56
lines changed

README.md

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
A Babel plugin to generate React PropTypes from TypeScript interfaces or type aliases.
88

9-
> Does not support converting external type references (as Babel has no type information) without
10-
> the `typeCheck` option being enabled.
9+
> This plugin DOES NOT support converting props who's type information is referenced in another
10+
> file, as Babel as no access to this information, and we do not run TypeScript's type checker.
1111
1212
## Examples
1313

@@ -445,50 +445,3 @@ class Example extends React.Component {
445445
}
446446
}
447447
```
448-
449-
#### `typeCheck` (boolean|string)
450-
451-
_NOT FINISHED_ Resolve full type information for aliases and references using TypeScript's built-in
452-
type checker. When enabled with `true`, will glob for files using `./src/**/*.ts`. Glob can be
453-
customized by passing a string. Defaults to `false`.
454-
455-
> Note: This process is heavy and may increase compilation times.
456-
457-
```tsx
458-
module.exports = {
459-
plugins: [['babel-plugin-typescript-to-proptypes', { typeCheck: true }]],
460-
};
461-
```
462-
463-
```tsx
464-
// Before
465-
import React from 'react';
466-
import { Location } from './types';
467-
468-
interface Props {
469-
location?: Location;
470-
}
471-
472-
class Example extends React.Component<Props> {
473-
render() {
474-
return <div />;
475-
}
476-
}
477-
478-
// After
479-
import React from 'react';
480-
import PropTypes from 'prop-types';
481-
482-
class Example extends React.Component {
483-
static propTypes = {
484-
location: PropTypes.shape({
485-
lat: PropTypes.number,
486-
long: PropTypes.number,
487-
}),
488-
};
489-
490-
render() {
491-
return <div />;
492-
}
493-
}
494-
```

src/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ export default (api: any, options: PluginOptions, root: string) => {
104104
return;
105105
}
106106

107-
// if (options.typeCheck) {
108-
// state.typeProgram = loadProgram(options.typeCheck, root);
109-
// state.typeChecker = state.typeProgram.getTypeChecker();
110-
// }
111-
112107
// Find existing `react` and `prop-types` imports
113108
programPath.node.body.forEach((node) => {
114109
if (!t.isImportDeclaration(node)) {

src/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,4 @@ export interface ConvertState {
4141
string,
4242
t.TSEnumDeclaration | t.TSEnumMember | t.TSInterfaceDeclaration | t.TSTypeAliasDeclaration
4343
>;
44-
typeChecker?: ts.TypeChecker;
45-
typeProgram?: ts.Program;
4644
}

0 commit comments

Comments
 (0)