Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
thompsongl committed Jul 16, 2020
1 parent e662d4c commit 8ec0354
Showing 1 changed file with 6 additions and 29 deletions.
35 changes: 6 additions & 29 deletions scripts/babel/proptypes-from-ts-props/index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/


/* eslint-disable new-cap */

const fs = require('fs');
Expand Down Expand Up @@ -523,7 +503,7 @@ function getPropTypesForNode(node, optional, state) {
// translates intersections (Foo & Bar & Baz) to a shape with the types' members (Foo, Bar, Baz) merged together
case 'TSIntersectionType':
const usableNodes = [...node.types].filter(node => {
const nodePropTypes = getPropTypesForNode(node, true, state);
let nodePropTypes = getPropTypesForNode(node, true, state);

if (
types.isMemberExpression(nodePropTypes) &&
Expand Down Expand Up @@ -773,14 +753,11 @@ function getPropTypesForNode(node, optional, state) {
),
[
types.arrayExpression(
node.properties.map(property => {
if (property.key) {
return types.stringLiteral(
property.key.name || property.key.value
)
}
return null;
})
node.properties.map(property =>
types.stringLiteral(
property.key.name || property.key.name || property.key.value
)
)
),
]
);
Expand Down

0 comments on commit 8ec0354

Please sign in to comment.