mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add a test for an Alias to an Alias (#46725)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46725 This covers types that deeply alias. Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D62926913 fbshipit-source-id: 2fea1900f1be2893230a949db6778c76afae0423
This commit is contained in:
committed by
Facebook GitHub Bot
parent
544c4ff75b
commit
c658e87518
+2
@@ -162,6 +162,7 @@ export type ObjectAlias = {|
|
||||
label: string,
|
||||
truthy: boolean,
|
||||
|};
|
||||
export type PureObjectAlias = ObjectAlias;
|
||||
export type ReadOnlyAlias = $ReadOnly<ObjectAlias>;
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
@@ -171,6 +172,7 @@ export interface Spec extends TurboModule {
|
||||
+getArray: (a: Array<A>) => {| a: B |};
|
||||
+getStringFromAlias: (a: ObjectAlias) => string;
|
||||
+getStringFromNullableAlias: (a: ?ObjectAlias) => string;
|
||||
+getStringFromPureAlias: (a: PureObjectAlias) => string;
|
||||
+getStringFromReadOnlyAlias: (a: ReadOnlyAlias) => string;
|
||||
+getStringFromNullableReadOnlyAlias: (a: ?ReadOnlyAlias) => string;
|
||||
}
|
||||
|
||||
+20
@@ -688,6 +688,26 @@ exports[`RN Codegen Flow Parser can generate fixture NATIVE_MODULE_WITH_ALIASES
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'getStringFromPureAlias',
|
||||
'optional': false,
|
||||
'typeAnnotation': {
|
||||
'type': 'FunctionTypeAnnotation',
|
||||
'returnTypeAnnotation': {
|
||||
'type': 'StringTypeAnnotation'
|
||||
},
|
||||
'params': [
|
||||
{
|
||||
'name': 'a',
|
||||
'optional': false,
|
||||
'typeAnnotation': {
|
||||
'type': 'TypeAliasTypeAnnotation',
|
||||
'name': 'ObjectAlias'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'getStringFromReadOnlyAlias',
|
||||
'optional': false,
|
||||
|
||||
+2
@@ -146,6 +146,7 @@ export type ObjectAlias = {
|
||||
label: string;
|
||||
truthy: boolean;
|
||||
};
|
||||
export type PureObjectAlias = ObjectAlias;
|
||||
export type ReadOnlyAlias = Readonly<ObjectAlias>;
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
@@ -155,6 +156,7 @@ export interface Spec extends TurboModule {
|
||||
readonly getArray: (a: Array<A>) => {a: B};
|
||||
readonly getStringFromAlias: (a: ObjectAlias) => string;
|
||||
readonly getStringFromNullableAlias: (a: ObjectAlias | null) => string;
|
||||
readonly getStringFromPureAlias: (a: PureObjectAlias) => string;
|
||||
readonly getStringFromReadOnlyAlias: (a: ReadOnlyAlias) => string;
|
||||
readonly getStringFromNullableReadOnlyAlias: (a: ReadOnlyAlias | null) => string;
|
||||
}
|
||||
|
||||
+20
@@ -679,6 +679,26 @@ exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_AL
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'getStringFromPureAlias',
|
||||
'optional': false,
|
||||
'typeAnnotation': {
|
||||
'type': 'FunctionTypeAnnotation',
|
||||
'returnTypeAnnotation': {
|
||||
'type': 'StringTypeAnnotation'
|
||||
},
|
||||
'params': [
|
||||
{
|
||||
'name': 'a',
|
||||
'optional': false,
|
||||
'typeAnnotation': {
|
||||
'type': 'TypeAliasTypeAnnotation',
|
||||
'name': 'ObjectAlias'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'getStringFromReadOnlyAlias',
|
||||
'optional': false,
|
||||
|
||||
Reference in New Issue
Block a user