fix(types): correct typescript function headers (#10404)
Flow maybe types state; > Maybe types accept the provided type as well as null or undefined. So ?number would mean number, null, or undefined. So in this case, explicitly allow the type, null, or undefined in the typescript definition. Fixes #10403
This commit is contained in:
parent
fc8e14264c
commit
15b63bc89e
@ -146,7 +146,7 @@ lines.push(
|
|||||||
`declare function isLet(node: BabelNode): boolean`,
|
`declare function isLet(node: BabelNode): boolean`,
|
||||||
`declare function isNode(node: ?Object): boolean`,
|
`declare function isNode(node: ?Object): boolean`,
|
||||||
`declare function isNodesEquivalent(a: any, b: any): boolean`,
|
`declare function isNodesEquivalent(a: any, b: any): boolean`,
|
||||||
`declare function isPlaceholderType(placeholderType: ?string, targetType: string): boolean`,
|
`declare function isPlaceholderType(placeholderType: string, targetType: string): boolean`,
|
||||||
`declare function isReferenced(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`,
|
`declare function isReferenced(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`,
|
||||||
`declare function isScope(node: BabelNode, parent: BabelNode): boolean`,
|
`declare function isScope(node: BabelNode, parent: BabelNode): boolean`,
|
||||||
`declare function isSpecifierDefault(specifier: BabelNodeModuleSpecifier): boolean`,
|
`declare function isSpecifierDefault(specifier: BabelNodeModuleSpecifier): boolean`,
|
||||||
|
|||||||
@ -153,13 +153,13 @@ lines.push(
|
|||||||
`export function isBlockScoped(node: Node): boolean`,
|
`export function isBlockScoped(node: Node): boolean`,
|
||||||
`export function isImmutable(node: Node): boolean`,
|
`export function isImmutable(node: Node): boolean`,
|
||||||
`export function isLet(node: Node): boolean`,
|
`export function isLet(node: Node): boolean`,
|
||||||
`export function isNode(node: ?object): boolean`,
|
`export function isNode(node: object | null | undefined): boolean`,
|
||||||
`export function isNodesEquivalent(a: any, b: any): boolean`,
|
`export function isNodesEquivalent(a: any, b: any): boolean`,
|
||||||
`export function isPlaceholderType(placeholderType: ?string, targetType: string): boolean`,
|
`export function isPlaceholderType(placeholderType: string, targetType: string): boolean`,
|
||||||
`export function isReferenced(node: Node, parent: Node, grandparent?: Node): boolean`,
|
`export function isReferenced(node: Node, parent: Node, grandparent?: Node): boolean`,
|
||||||
`export function isScope(node: Node, parent: Node): boolean`,
|
`export function isScope(node: Node, parent: Node): boolean`,
|
||||||
`export function isSpecifierDefault(specifier: ModuleSpecifier): boolean`,
|
`export function isSpecifierDefault(specifier: ModuleSpecifier): boolean`,
|
||||||
`export function isType(nodetype: ?string, targetType: string): boolean`,
|
`export function isType(nodetype: string | null | undefined, targetType: string): boolean`,
|
||||||
`export function isValidES3Identifier(name: string): boolean`,
|
`export function isValidES3Identifier(name: string): boolean`,
|
||||||
`export function isValidES3Identifier(name: string): boolean`,
|
`export function isValidES3Identifier(name: string): boolean`,
|
||||||
`export function isValidIdentifier(name: string): boolean`,
|
`export function isValidIdentifier(name: string): boolean`,
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { PLACEHOLDERS_ALIAS } from "../definitions";
|
|||||||
* Test if a `placeholderType` is a `targetType` or if `targetType` is an alias of `placeholderType`.
|
* Test if a `placeholderType` is a `targetType` or if `targetType` is an alias of `placeholderType`.
|
||||||
*/
|
*/
|
||||||
export default function isPlaceholderType(
|
export default function isPlaceholderType(
|
||||||
placeholderType: ?string,
|
placeholderType: string,
|
||||||
targetType: string,
|
targetType: string,
|
||||||
): boolean {
|
): boolean {
|
||||||
if (placeholderType === targetType) return true;
|
if (placeholderType === targetType) return true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user