Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix: remove faulty array-property detection
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed Sep 10, 2018
1 parent 0200271 commit 39542de
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,69 +106,13 @@ function createProperty(
return createNumberProperty(init, ctx);
}

if (init.typechecker.isArrayLikeType(init.type)) {
return createArrayProperty(init, ctx);
}

if (ReactUtils.isReactEventHandlerType(init.type, { program: ctx.program })) {
return createEventHandlerProperty(init, ctx);
}

return;
}

function createArrayProperty(
args: PropertyInit,
ctx: PropertyAnalyzeContext
):
| Types.SerializedPatternNumberArrayProperty
| Types.SerializedPatternStringArrayProperty
| undefined {
const arrayType: Ts.GenericType = args.type as Ts.GenericType;

if (!arrayType.typeArguments) {
return;
}

const [itemType] = arrayType.typeArguments;

if ((itemType.flags & Ts.TypeFlags.String) === Ts.TypeFlags.String) {
return {
contextId: args.symbol.name,
defaultValue: [],
description: '',
example: '',
hidden: false,
id: ctx.getPropertyId(args.symbol.name),
inputType: Types.PatternPropertyInputType.Default,
label: args.symbol.name,
origin: 'user-provided',
propertyName: args.symbol.name,
required: false,
type: Types.PatternPropertyType.StringArray
};
}

if ((itemType.flags & Ts.TypeFlags.Number) === Ts.TypeFlags.Number) {
return {
contextId: args.symbol.name,
defaultValue: [],
description: '',
example: '',
hidden: false,
id: ctx.getPropertyId(args.symbol.name),
inputType: Types.PatternPropertyInputType.Default,
label: args.symbol.name,
origin: 'user-provided',
propertyName: args.symbol.name,
required: false,
type: Types.PatternPropertyType.NumberArray
};
}

return;
}

function createBooleanProperty(
args: PropertyInit,
ctx: PropertyAnalyzeContext
Expand Down
22 changes: 0 additions & 22 deletions src/analyzer/typescript-utils/typescript-internals.d.ts

This file was deleted.

0 comments on commit 39542de

Please sign in to comment.