Skip to content

Commit

Permalink
Merge branch 'master' of github.com:flow-typed/flow-typed
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Chen committed Jan 10, 2024
2 parents b28ce2d + e194262 commit 820a228
Show file tree
Hide file tree
Showing 25 changed files with 56 additions and 8 deletions.
Expand Up @@ -4,5 +4,5 @@ import '@babel/polyfill';
// This should fail but couldn't make it to do so
import defaultValue from '@babel/polyfill';

// $FlowExpectedError does not export anything
// $FlowExpectedError[missing-export] does not export anything
import { namedExport } from '@babel/polyfill';
Expand Up @@ -4,5 +4,5 @@ import '@babel/polyfill';
// This should fail but couldn't make it to do so
import defaultValue from '@babel/polyfill';

// $FlowExpectedError does not export anything
// $FlowExpectedError[missing-export] does not export anything
import { namedExport } from '@babel/polyfill';
Expand Up @@ -3,7 +3,7 @@ import { describe, it } from 'flow-typed-test';

describe('unknown properties', () => {
it('are not allowed', () => {
// $FlowExpectedError does not accept unknown props
// $FlowExpectedError[prop-missing] does not accept unknown props
require('@babel/register')({
unknown: 'property'
});
Expand All @@ -20,14 +20,12 @@ describe('plugins', () => {
});
});
it('does not accept anything else', () => {
// $FlowExpectedError no numbers
require('@babel/register')({
plugins: [
123
]
// $FlowExpectedError[incompatible-call] no numbers
plugins: [123]
});
// $FlowExpectedError should be array
require('@babel/register')({
// $FlowExpectedError[incompatible-call] should be array
plugins: 'my-plugin'
});
})
Expand Down
Expand Up @@ -78,6 +78,7 @@ declare module 'axios' {
httpsAgent?: HttpsAgent,
maxContentLength?: number,
maxRedirects?: number,
signal?: AbortSignal,
socketPath?: string | null,
params?: { [key: string]: mixed, ...},
paramsSerializer?: (params: { [key: string]: mixed, ...}) => string,
Expand Down
Expand Up @@ -84,6 +84,7 @@ const config: $AxiosXHRConfigBase<RequestDataUser, User> = {
maxContentLength: 2000,
validateStatus: (status: number) => status >= 200 && status < 300,
maxRedirects: 5,
signal: (new AbortController()).signal,
proxy: {
host: '127.0.0.1',
port: 9000,
Expand Down
Expand Up @@ -78,6 +78,7 @@ declare module 'axios' {
httpsAgent?: HttpsAgent,
maxContentLength?: number,
maxRedirects?: number,
signal?: AbortSignal,
socketPath?: string | null,
params?: { [key: string]: mixed, ...},
paramsSerializer?: (params: { [key: string]: mixed, ...}) => string,
Expand Down
Expand Up @@ -84,6 +84,7 @@ const config: $AxiosXHRConfigBase<RequestDataUser, User> = {
maxContentLength: 2000,
validateStatus: (status: number) => status >= 200 && status < 300,
maxRedirects: 5,
signal: (new AbortController()).signal,
proxy: {
host: '127.0.0.1',
port: 9000,
Expand Down
Expand Up @@ -78,6 +78,7 @@ declare module 'axios' {
httpsAgent?: HttpsAgent,
maxContentLength?: number,
maxRedirects?: number,
signal?: AbortSignal,
socketPath?: string | null,
params?: { [key: string]: mixed, ...},
paramsSerializer?: (params: { [key: string]: mixed, ...}) => string,
Expand Down
Expand Up @@ -84,6 +84,7 @@ const config: $AxiosXHRConfigBase<RequestDataUser, User> = {
maxContentLength: 2000,
validateStatus: (status: number) => status >= 200 && status < 300,
maxRedirects: 5,
signal: (new AbortController()).signal,
proxy: {
host: '127.0.0.1',
port: 9000,
Expand Down
Expand Up @@ -78,6 +78,7 @@ declare module 'axios' {
httpsAgent?: HttpsAgent,
maxContentLength?: number,
maxRedirects?: number,
signal?: AbortSignal,
socketPath?: string | null,
params?: { [key: string]: mixed, ...},
paramsSerializer?: (params: { [key: string]: mixed, ...}) => string,
Expand Down
Expand Up @@ -84,6 +84,7 @@ const config: $AxiosXHRConfigBase<RequestDataUser, User> = {
maxContentLength: 2000,
validateStatus: (status: number) => status >= 200 && status < 300,
maxRedirects: 5,
signal: (new AbortController()).signal,
proxy: {
host: '127.0.0.1',
port: 9000,
Expand Down
Expand Up @@ -78,6 +78,7 @@ declare module 'axios' {
httpsAgent?: HttpsAgent,
maxContentLength?: number,
maxRedirects?: number,
signal?: AbortSignal,
socketPath?: string | null,
params?: { [key: string]: mixed, ...},
paramsSerializer?: (params: { [key: string]: mixed, ...}) => string,
Expand Down
Expand Up @@ -85,6 +85,7 @@ const config: $AxiosXHRConfigBase<RequestDataUser, User> = {
maxContentLength: 2000,
validateStatus: (status: number) => status >= 200 && status < 300,
maxRedirects: 5,
signal: (new AbortController()).signal,
proxy: {
host: '127.0.0.1',
port: 9000,
Expand Down
Expand Up @@ -78,6 +78,7 @@ declare module 'axios' {
httpsAgent?: HttpsAgent,
maxContentLength?: number,
maxRedirects?: number,
signal?: AbortSignal,
socketPath?: string | null,
params?: { [key: string]: mixed, ...},
paramsSerializer?: (params: { [key: string]: mixed, ...}) => string,
Expand Down
Expand Up @@ -85,6 +85,7 @@ const config: $AxiosXHRConfigBase<RequestDataUser, User> = {
maxContentLength: 2000,
validateStatus: (status: number) => status >= 200 && status < 300,
maxRedirects: 5,
signal: (new AbortController()).signal,
proxy: {
host: '127.0.0.1',
port: 9000,
Expand Down
Expand Up @@ -73,6 +73,7 @@ declare module 'axios' {
httpsAgent?: HttpsAgent,
maxContentLength?: number,
maxRedirects?: number,
signal?: AbortSignal,
socketPath?: string | null,
params?: { [key: string]: mixed, ...},
paramsSerializer?: (params: { [key: string]: mixed, ...}) => string,
Expand Down
Expand Up @@ -85,6 +85,7 @@ const config: $AxiosXHRConfigBase<RequestDataUser, User> = {
maxContentLength: 2000,
validateStatus: (status: number) => status >= 200 && status < 300,
maxRedirects: 5,
signal: (new AbortController()).signal,
proxy: {
host: '127.0.0.1',
port: 9000,
Expand Down
Expand Up @@ -73,6 +73,7 @@ declare module 'axios' {
httpsAgent?: HttpsAgent,
maxContentLength?: number,
maxRedirects?: number,
signal?: AbortSignal,
socketPath?: string | null,
params?: { [key: string]: mixed, ...},
paramsSerializer?: (params: { [key: string]: mixed, ...}) => string,
Expand Down
Expand Up @@ -85,6 +85,7 @@ const config: $AxiosXHRConfigBase<RequestDataUser, User> = {
maxContentLength: 2000,
validateStatus: (status: number) => status >= 200 && status < 300,
maxRedirects: 5,
signal: (new AbortController()).signal,
proxy: {
host: '127.0.0.1',
port: 9000,
Expand Down
3 changes: 3 additions & 0 deletions definitions/npm/axios_v1.x.x/flow_v0.201.x-/axios_v1.x.x.js
Expand Up @@ -73,6 +73,7 @@ declare module 'axios' {
httpsAgent?: HttpsAgent,
maxContentLength?: number,
maxRedirects?: number,
signal?: AbortSignal,
socketPath?: string | null,
params?: { [key: string]: mixed, ...},
paramsSerializer?: (params: { [key: string]: mixed, ...}) => string,
Expand Down Expand Up @@ -119,6 +120,7 @@ declare module 'axios' {
onRejected: ?(error: mixed) => mixed
): AxiosInterceptorIdent,
eject(ident: AxiosInterceptorIdent): void,
clear(): void,
|};

declare type AxiosResponseInterceptor<T, R = T> = {|
Expand All @@ -127,6 +129,7 @@ declare module 'axios' {
onRejected: ?(error: mixed) => mixed
): AxiosInterceptorIdent,
eject(ident: AxiosInterceptorIdent): void,
clear(): void,
|};

declare type AxiosPromise<T, R = T> = Promise<AxiosXHR<T, R>>;
Expand Down
Expand Up @@ -85,6 +85,7 @@ const config: $AxiosXHRConfigBase<RequestDataUser, User> = {
maxContentLength: 2000,
validateStatus: (status: number) => status >= 200 && status < 300,
maxRedirects: 5,
signal: (new AbortController()).signal,
proxy: {
host: '127.0.0.1',
port: 9000,
Expand Down Expand Up @@ -307,6 +308,7 @@ describe('Interceptors', () => {
);

axios.interceptors.request.eject(requestInterceptorId);
axios.interceptors.request.clear();

axios.interceptors.request.use(
(config: $AxiosXHRConfig<mixed>) => Promise.resolve(config),
Expand All @@ -326,6 +328,7 @@ describe('Interceptors', () => {
);

axios.interceptors.response.eject(responseInterceptorId);
axios.interceptors.response.clear();

axios.interceptors.response.use(
(response: $AxiosXHR<mixed>) => Promise.resolve(response),
Expand Down
Expand Up @@ -73,6 +73,7 @@ declare module 'axios' {
httpsAgent?: HttpsAgent,
maxContentLength?: number,
maxRedirects?: number,
signal?: AbortSignal,
socketPath?: string | null,
params?: { [key: string]: mixed, ...},
paramsSerializer?: (params: { [key: string]: mixed, ...}) => string,
Expand Down Expand Up @@ -119,6 +120,7 @@ declare module 'axios' {
onRejected: ?(error: mixed) => mixed
): AxiosInterceptorIdent,
eject(ident: AxiosInterceptorIdent): void,
clear(): void,
|};

declare type AxiosResponseInterceptor<T, R = T> = {|
Expand All @@ -127,6 +129,7 @@ declare module 'axios' {
onRejected: ?(error: mixed) => mixed
): AxiosInterceptorIdent,
eject(ident: AxiosInterceptorIdent): void,
clear(): void,
|};

declare type AxiosPromise<T, R = T> = Promise<AxiosXHR<T, R>>;
Expand Down
Expand Up @@ -85,6 +85,7 @@ const config: $AxiosXHRConfigBase<RequestDataUser, User> = {
maxContentLength: 2000,
validateStatus: (status: number) => status >= 200 && status < 300,
maxRedirects: 5,
signal: (new AbortController()).signal,
proxy: {
host: '127.0.0.1',
port: 9000,
Expand Down Expand Up @@ -307,6 +308,7 @@ describe('Interceptors', () => {
);

axios.interceptors.request.eject(requestInterceptorId);
axios.interceptors.request.clear();

axios.interceptors.request.use(
(config: $AxiosXHRConfig<mixed>) => Promise.resolve(config),
Expand All @@ -326,6 +328,7 @@ describe('Interceptors', () => {
);

axios.interceptors.response.eject(responseInterceptorId);
axios.interceptors.response.clear();

axios.interceptors.response.use(
(response: $AxiosXHR<mixed>) => Promise.resolve(response),
Expand Down
Expand Up @@ -597,6 +597,7 @@ declare module 'react-router-dom' {
basename: string,
navigator: Navigator,
static: boolean,
future: {| v7_relativeSplatPath: boolean |},
|};

declare export var UNSAFE_NavigationContext: React$Context<NavigationContextObject>;
Expand Down
Expand Up @@ -1068,6 +1068,9 @@ describe('react-router-dom', () => {
basename: 'test',
navigator: nav,
static: false,
future: {
v7_relativeSplatPath: true,
},
}}
/>);
const B = (<Comp
Expand All @@ -1080,6 +1083,9 @@ describe('react-router-dom', () => {
basename: 123,
navigator: nav,
static: false,
future: {
v7_relativeSplatPath: true,
},
}}
/>);
const D = (<Comp
Expand All @@ -1088,6 +1094,9 @@ describe('react-router-dom', () => {
// $FlowExpectedError[incompatible-type]
navigator: 'test',
static: false,
future: {
v7_relativeSplatPath: true,
},
}}
/>);
const E = (<Comp
Expand All @@ -1096,6 +1105,18 @@ describe('react-router-dom', () => {
navigator: nav,
// $FlowExpectedError[incompatible-type]
static: 123,
future: {
v7_relativeSplatPath: true,
},
}}
/>);
const F = (<Comp
context={{
basename: 'test',
navigator: nav,
static: false,
// $FlowExpectedError[prop-missing]
future: {},
}}
/>);
});
Expand Down

0 comments on commit 820a228

Please sign in to comment.