{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/fetch-client/issues/19","labels_url":"https://api.github.com/repos/aurelia/fetch-client/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/fetch-client/issues/19/comments","events_url":"https://api.github.com/repos/aurelia/fetch-client/issues/19/events","html_url":"https://github.com/aurelia/fetch-client/issues/19","id":115489757,"number":19,"title":"Typescript and Interceptors","user":{"login":"Ullfis","id":10699174,"avatar_url":"https://avatars.githubusercontent.com/u/10699174?v=3","gravatar_id":"","url":"https://api.github.com/users/Ullfis","html_url":"https://github.com/Ullfis","followers_url":"https://api.github.com/users/Ullfis/followers","following_url":"https://api.github.com/users/Ullfis/following{/other_user}","gists_url":"https://api.github.com/users/Ullfis/gists{/gist_id}","starred_url":"https://api.github.com/users/Ullfis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ullfis/subscriptions","organizations_url":"https://api.github.com/users/Ullfis/orgs","repos_url":"https://api.github.com/users/Ullfis/repos","events_url":"https://api.github.com/users/Ullfis/events{/privacy}","received_events_url":"https://api.github.com/users/Ullfis/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aurelia/fetch-client/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-06T11:37:04Z","updated_at":"2015-11-10T06:56:24Z","closed_at":null,"body":"Thank you for your excellent work on Aurelia and all her components.\r\n\r\nAfter testing typescript and fetch-client I believe the definition file need a tiny change.\r\n\r\nThis wont compile (from https://gist.github.com/bryanrsmith/14caed2015b9c54e70c3):\r\n```javascript\r\nhttpClient.configure(config => {\r\n    config\r\n        .withBaseUrl('api/')\r\n        .withDefaults({\r\n            credentials: 'same-origin',\r\n            headers: {\r\n                'Accept': 'application/json',\r\n                'X-Requested-With': 'Fetch'\r\n            }\r\n        })\r\n        .withInterceptor({\r\n            request(request) {\r\n                console.log(`Requesting ${request.method} ${request.url}`);\r\n                return request; // you can return a modified Request, or you can short-circuit the request by returning a Response\r\n            },\r\n            response(response) {\r\n                console.log(`Received ${response.status} ${response.url}`);\r\n                return response; // you can return a modified Response\r\n            }\r\n        });\r\n});\r\n```\r\n\r\nFrom aurelia-fetch-client.d.ts:\r\n\r\n```javascript\r\n79. withInterceptor(interceptor: Interceptor): HttpClientConfiguration;\r\n```\r\n\r\nand\r\n\r\n```javascript\r\n4. /* eslint-disable */\r\nexport interface Interceptor {\r\n  request(request: Request): Request | Response | Promise<Request | Response>;\r\n  requestError(error: any): Request | Response | Promise<Request | Response>;\r\n  response(response: Response): Response | Promise<Response>;\r\n  responseError(error: any): Response | Promise<Response>;\r\n}\r\n```\r\n\r\nI have not read the source (yet) but I don't think its necessary to define all Interceptors. Compiling/running project with suggested change work.\r\n\r\n\r\nChange suggestion (add '?'):\r\n\r\n```javascript\r\n4. /* eslint-disable */\r\nexport interface Interceptor {\r\n  request?(request: Request): Request | Response | Promise<Request | Response>;\r\n  requestError?(error: any): Request | Response | Promise<Request | Response>;\r\n  response?(response: Response): Response | Promise<Response>;\r\n  responseError?(error: any): Response | Promise<Response>;\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/aurelia/fetch-client/issues/comments/155329440","html_url":"https://github.com/aurelia/fetch-client/issues/19#issuecomment-155329440","issue_url":"https://api.github.com/repos/aurelia/fetch-client/issues/19","id":155329440,"user":{"login":"bryanrsmith","id":186704,"avatar_url":"https://avatars.githubusercontent.com/u/186704?v=3","gravatar_id":"","url":"https://api.github.com/users/bryanrsmith","html_url":"https://github.com/bryanrsmith","followers_url":"https://api.github.com/users/bryanrsmith/followers","following_url":"https://api.github.com/users/bryanrsmith/following{/other_user}","gists_url":"https://api.github.com/users/bryanrsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanrsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanrsmith/subscriptions","organizations_url":"https://api.github.com/users/bryanrsmith/orgs","repos_url":"https://api.github.com/users/bryanrsmith/repos","events_url":"https://api.github.com/users/bryanrsmith/events{/privacy}","received_events_url":"https://api.github.com/users/bryanrsmith/received_events","type":"User","site_admin":false},"created_at":"2015-11-10T06:56:24Z","updated_at":"2015-11-10T06:56:24Z","body":"Yes, they are all optional, and appear to be marked that way in source: https://github.com/aurelia/fetch-client/blob/master/src/interfaces.js#L15\r\n\r\n@cmichaelgraham Is there maybe something wrong with the syntax I'm using, or a bug in the generator?"}}