Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should raise an error when lead to an incompatible type', () => {
// $ExpectError
(Constants.debugMode: 'ups...');
// $ExpectError
(Constants.deviceName: 'ups...');
// $ExpectError
(Constants.deviceYearClass: 'ups...');
// $ExpectError
(Constants.experienceUrl: 'ups...');
// $ExpectError
(Constants.expoRuntimeVersion: 'ups...');
// $ExpectError
(Constants.expoVersion: 'ups...');
// $ExpectError
(Constants.isDetached: 'ups...');
// $ExpectError
(Constants.intentUri: 'ups...');
// $ExpectError
(Constants.installationId: 'ups...');
// $ExpectError
(Constants.isDevice: 'ups...');
async function _sendNextLogBatchAsync(batch: LogEntry[], logUrl: string): Promise {
let response;
let headers = {
'Content-Type': 'application/json',
Connection: 'keep-alive',
'Proxy-Connection': 'keep-alive',
Accept: 'application/json',
'Device-Id': Constants.installationId,
'Session-Id': _sessionId,
};
if (Constants.deviceName) {
headers['Device-Name'] = Constants.deviceName;
}
try {
response = await fetch(logUrl, {
method: 'POST',
headers,
body: JSON.stringify(batch),
});
} catch (error) {
_transportEventEmitter.emit('error', { error });
return;
}
let success = response.status >= 200 && response.status < 300;
if (!success) {
_transportEventEmitter.emit('error', {
error: new Error(`An HTTP error occurred when sending remote logs`),
async function _sendNextLogBatchAsync(batch, logUrl) {
let response;
let headers = {
'Content-Type': 'application/json',
Connection: 'keep-alive',
'Proxy-Connection': 'keep-alive',
Accept: 'application/json',
'Device-Id': Constants.installationId,
'Session-Id': _sessionId,
};
if (Constants.deviceName) {
headers['Device-Name'] = Constants.deviceName;
}
try {
response = await fetch(logUrl, {
method: 'POST',
headers,
body: JSON.stringify(batch),
});
}
catch (error) {
_transportEventEmitter.emit('error', { error });
return;
}
let success = response.status >= 200 && response.status < 300;
if (!success) {
_transportEventEmitter.emit('error', {
error: new Error(`An HTTP error occurred when sending remote logs`),
async function _sendNextLogBatchAsync(batch: LogEntry[], logUrl: string): Promise {
let response;
let headers = {
'Content-Type': 'application/json',
Connection: 'keep-alive',
'Proxy-Connection': 'keep-alive',
Accept: 'application/json',
'Device-Id': Constants.installationId,
'Session-Id': _sessionId,
};
if (Constants.deviceName) {
headers['Device-Name'] = Constants.deviceName;
}
try {
response = await fetch(logUrl, {
method: 'POST',
headers,
body: JSON.stringify(batch),
});
} catch (error) {
_transportEventEmitter.emit('error', { error });
return;
}
let success = response.status >= 200 && response.status < 300;
if (!success) {
_transportEventEmitter.emit('error', {
async function _sendNextLogBatchAsync(batch, logUrl) {
let response;
let headers = {
'Content-Type': 'application/json',
Connection: 'keep-alive',
'Proxy-Connection': 'keep-alive',
Accept: 'application/json',
'Device-Id': Constants.installationId,
'Session-Id': _sessionId,
};
if (Constants.deviceName) {
headers['Device-Name'] = Constants.deviceName;
}
try {
response = await fetch(logUrl, {
method: 'POST',
headers,
body: JSON.stringify(batch),
});
}
catch (error) {
_transportEventEmitter.emit('error', { error });
return;
}
let success = response.status >= 200 && response.status < 300;
if (!success) {
_transportEventEmitter.emit('error', {
public render() {
const navigate = this.props.navigation.navigate;
return (