Skip to content

Update dependencies #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
631 changes: 0 additions & 631 deletions .yarn/releases/yarn-3.0.0.cjs

This file was deleted.

873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.5.0.cjs

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
enableGlobalCache: true

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: '@yarnpkg/plugin-typescript'

yarnPath: .yarn/releases/yarn-3.0.0.cjs
yarnPath: .yarn/releases/yarn-3.5.0.cjs
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript-to-proptypes",
"packageManager": "yarn@3.0.0",
"packageManager": "yarn@3.5.0",
"version": "2.2.1",
"description": "Generate proptypes from typescript declarations",
"main": "dist/index.js",
Expand Down Expand Up @@ -54,7 +54,7 @@
"doctrine": "^3.0.0",
"lodash": "^4.17.14",
"tslib": "^1.13.0",
"typescript": "3.8.3",
"typescript": "^4.0.0",
"uuid": "^8.1.0"
},
"dependenciesMeta": {
Expand Down
4 changes: 2 additions & 2 deletions src/injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,11 @@ function plugin(
} else if (babelTypes.isExportNamedDeclaration(path.parent)) {
path.insertAfter(babel.template.ast(`export { ${nodeName} };`));
path.insertAfter(babel.template.ast(placeholder));
path.parentPath.replaceWith(path.node);
path.parentPath?.replaceWith(path.node);
} else if (babelTypes.isExportDefaultDeclaration(path.parent)) {
path.insertAfter(babel.template.ast(`export default ${nodeName};`));
path.insertAfter(babel.template.ast(placeholder));
path.parentPath.replaceWith(path.node);
path.parentPath?.replaceWith(path.node);
} else {
path.insertAfter(babel.template.ast(placeholder));
}
Expand Down
15 changes: 11 additions & 4 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,23 @@ export function parseFromProgram(
}
const componentName = node.name.getText();

if (symbol.valueDeclaration === undefined) {
return;
}

const type = checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);
type.getCallSignatures().forEach((signature) => {
if (!isTypeJSXElementLike(signature.getReturnType())) {
return;
}

const propsType = checker.getTypeOfSymbolAtLocation(
signature.parameters[0],
signature.parameters[0].valueDeclaration
);
const declaration = signature.parameters[0]?.valueDeclaration;

if (declaration === undefined) {
return;
}

const propsType = checker.getTypeOfSymbolAtLocation(signature.parameters[0], declaration);

parsePropsType(componentName, propsType, node.getSourceFile());
});
Expand Down
35 changes: 18 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Manual changes might be lost - proceed with caution!

__metadata:
version: 4
version: 6
cacheKey: 8

"@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.5.5":
Expand Down Expand Up @@ -2954,15 +2954,16 @@ fsevents@^2.1.2:
dependencies:
node-gyp: latest
checksum: 63fe1ba77b63d5da5dde6112c5f0eb161b9d18a61427a8a49d661eeed080189d99e8f9da11bb6b75ecd5129a69edc5757d60a4eb0bbada6de68d5156c382c5e1
conditions: os=darwin
languageName: node
linkType: hard

"fsevents@patch:fsevents@^2.1.2#~builtin<compat/fsevents>":
version: 2.1.2
resolution: "fsevents@patch:fsevents@npm%3A2.1.2#~builtin<compat/fsevents>::version=2.1.2&hash=1cc4b2"
resolution: "fsevents@patch:fsevents@npm%3A2.1.2#~builtin<compat/fsevents>::version=2.1.2&hash=31d12a"
dependencies:
node-gyp: latest
checksum: 1cf5ff06cfd99ca4b005b59d239aa7dd699407ac1ea3ab1b966405d8f61615e67aa87dcf76ae9ba9e7f7ba8a2649cbd5021b0ade58c90337c2577a9ed92f493a
conditions: os=darwin
languageName: node
linkType: hard

Expand Down Expand Up @@ -4016,7 +4017,7 @@ fsevents@^2.1.2:
languageName: node
linkType: hard

"jest-resolve@npm:26.0.1, jest-resolve@npm:^26.0.1":
"jest-resolve@npm:^26.0.1":
version: 26.0.1
resolution: "jest-resolve@npm:26.0.1"
dependencies:
Expand Down Expand Up @@ -5909,19 +5910,19 @@ resolve@^1.17.0:

"resolve@patch:resolve@^1.1.6#~builtin<compat/resolve>, resolve@patch:resolve@^1.10.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.3.2#~builtin<compat/resolve>":
version: 1.11.1
resolution: "resolve@patch:resolve@npm%3A1.11.1#~builtin<compat/resolve>::version=1.11.1&hash=00b1ff"
resolution: "resolve@patch:resolve@npm%3A1.11.1#~builtin<compat/resolve>::version=1.11.1&hash=c3c19d"
dependencies:
path-parse: ^1.0.6
checksum: da558904739a6c6c5926f006c85da78c15189572ca7fa2113b84bee1b2218e4e43e78041e0dbaeed00d3bf9217b2de4c1329a0b9f3a6885706c74235be873720
checksum: fc3e272f1b1016888441d4d78591f7cfa7eed88a24e3d1fa52299e91135c37fd455232c394972b8e1fcc1b8433b62db943d1a7cc4f18a7a0593eb15f99668777
languageName: node
linkType: hard

"resolve@patch:resolve@^1.17.0#~builtin<compat/resolve>":
version: 1.17.0
resolution: "resolve@patch:resolve@npm%3A1.17.0#~builtin<compat/resolve>::version=1.17.0&hash=00b1ff"
resolution: "resolve@patch:resolve@npm%3A1.17.0#~builtin<compat/resolve>::version=1.17.0&hash=c3c19d"
dependencies:
path-parse: ^1.0.6
checksum: a3606308046ca75c0a6350c26df636b64a71904a8e00f3181fd838b46b4fc303c32ae3e694c156eae5d9102cbe194c444f85822d8e6ce30cf7c510e412029908
checksum: 6fd799f282ddf078c4bc20ce863e3af01fa8cb218f0658d9162c57161a2dbafe092b13015b9a4c58d0e1e801cf7aa7a4f13115fea9db98c3f9a0c43e429bad6f
languageName: node
linkType: hard

Expand Down Expand Up @@ -6912,31 +6913,31 @@ resolve@^1.17.0:
standard-version: ^8.0.0
ts-jest: ^26.1.0
tslib: ^1.13.0
typescript: 3.8.3
typescript: ^4.0.0
uuid: ^8.1.0
dependenciesMeta:
core-js:
built: false
languageName: unknown
linkType: soft

typescript@3.8.3:
version: 3.8.3
resolution: "typescript@npm:3.8.3"
"typescript@npm:^4.0.0":
version: 4.9.5
resolution: "typescript@npm:4.9.5"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 3ef07f997a9a3af80d663cc611be984d3e22df3dc2b5ecfa6cbe7dbd54f1984fa1c679ba67e6a9d36d73ffdbbab88a0fbb58eb30ffc4f748f3a3c28d562b546a
checksum: ee000bc26848147ad423b581bd250075662a354d84f0e06eb76d3b892328d8d4440b7487b5a83e851b12b255f55d71835b008a66cbf8f255a11e4400159237db
languageName: node
linkType: hard

"typescript@patch:typescript@3.8.3#~builtin<compat/typescript>":
version: 3.8.3
resolution: "typescript@patch:typescript@npm%3A3.8.3#~builtin<compat/typescript>::version=3.8.3&hash=d8b4e7"
"typescript@patch:typescript@^4.0.0#~builtin<compat/typescript>":
version: 4.9.5
resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin<compat/typescript>::version=4.9.5&hash=23ec76"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 225f11e8f4c2f02619af395af9d71fee8ce775d548df8a84647f8a9629905b743949f64f61c12a21fd69f66fa71483fb1e41049e9cadaf92d438ea61e40a1f44
checksum: ab417a2f398380c90a6cf5a5f74badd17866adf57f1165617d6a551f059c3ba0a3e4da0d147b3ac5681db9ac76a303c5876394b13b3de75fdd5b1eaa06181c9d
languageName: node
linkType: hard

Expand Down