Fix implicit any issues

This commit is contained in:
Joe Skeen
2015-10-07 10:01:23 -06:00
parent 31d1cc43cd
commit b06d25ff7a
3 changed files with 57 additions and 59 deletions
+16 -18
View File
@@ -37,7 +37,6 @@ import fs = require('fs');
import http = require('http');
var request = rp;
//The following examples from https://github.com/request/request
request('http://www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body); // Show the HTML for the Google homepage.
@@ -52,7 +51,7 @@ request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img
request
.get('http://google.com/img.png')
.on('response', function(response) {
.on('response', function(response: any) {
console.log(response.statusCode); // 200
console.log(response.headers['content-type']); // 'image/png'
})
@@ -60,7 +59,7 @@ request
request
.get('http://mysite.com/doodle.png')
.on('error', function(err) {
.on('error', function(err: any) {
console.log(err);
})
.pipe(fs.createWriteStream('doodle.png'));
@@ -212,7 +211,7 @@ options = {
}
};
function callback(error, response, body) {
function callback(error: any, response: http.IncomingMessage, body: string) {
if (!error && response.statusCode == 200) {
var info = JSON.parse(body);
console.log(info.stargazers_count + " Stars");
@@ -248,7 +247,7 @@ request.post({url:url, oauth:oauth}, function (e, r, body) {
// step 3
// after the user is redirected back to your server
var auth_data = qs.parse(body)
var auth_data: any = qs.parse(body)
, oauth =
{ consumer_key: CONSUMER_KEY
, consumer_secret: CONSUMER_SECRET
@@ -260,20 +259,19 @@ request.post({url:url, oauth:oauth}, function (e, r, body) {
;
request.post({url:url, oauth:oauth}, function (e, r, body) {
// ready to make signed requests on behalf of the user
var perm_data = qs.parse(body)
, oauth =
var perm_data: any = qs.parse(body);
var oauth =
{ consumer_key: CONSUMER_KEY
, consumer_secret: CONSUMER_SECRET
, token: perm_data.oauth_token
, token_secret: perm_data.oauth_token_secret
}
, url = 'https://api.twitter.com/1.1/users/show.json'
, qs =
{ screen_name: perm_data.screen_name
, user_id: perm_data.user_id
}
;
request.get({url:url, oauth:oauth, qs:qs, json:true}, function (e, r, user) {
};
var url = 'https://api.twitter.com/1.1/users/show.json';
var query = {
screen_name: perm_data.screen_name,
user_id: perm_data.user_id
};
request.get({url:url, oauth:oauth, qs:query, json:true}, function (e, r, user) {
console.log(user);
});
});
@@ -418,13 +416,13 @@ request(
console.log('server encoded the data as: ' + (response.headers['content-encoding'] || 'identity'))
console.log('the decoded data is: ' + body)
}
).on('data', function(data) {
).on('data', function(data: any) {
// decompressed data as it is received
console.log('decoded chunk: ' + data)
})
.on('response', function(response) {
.on('response', function(response: http.IncomingMessage) {
// unmodified http.IncomingMessage object
response.on('data', function(data) {
response.on('data', function(data: any[]) {
// compressed data as it is received
console.log('received ' + data.length + ' bytes of compressed data')
})