Open rabbitfang opened 8 years ago
Not sure if this helps, but here's a partial definition file that probably has bugs in it, but will at least compile:
/// raven v0.12.x
///******************
/// <reference path="../node/node.d.ts" />
declare namespace raven {
export class Client {
// Passing any falsey value as the DSN will disable sending events upstream:
constructor(dsn: string, options?: ConstructorOptions);
captureException(error: Error, options?: CaptureOptions, cb?: CaptureCallback): void; // Send an error to sentry
captureMessage(message: string, options?: CaptureOptions, cb?: CaptureCallback): void; // Send a log message to sentry
setUserContext(data: UserData): void; // While a user is logged in, you can tell Sentry to associate errors with user data.
}
interface UserData {
id: string;
handle?: string;
}
interface CaptureCallback {
(result: { string: any }): void
}
interface DataCallback {
(data: { string: any }): void
}
interface TransportCallback {
(options: { string: any }): void
}
export interface ConstructorOptions {
logger?: string; // The name of the logger used by Sentry. Default: ''
release?: string; // Track the version of your application in Sentry.
environment?: string; // Track the environment name inside Sentry.
tags?: { string: string }; // Additional tags to assign to each event. E.g. {git_commit: 'c0deb10c4'}
extra?: { string: string }; // Arbitrary data to associate with the event.
dataCallback?: DataCallback; // A function that allows mutation of the data payload right before being sent to Sentry.
transport?: TransportCallback; // Override the default HTTP data transport handler.
}
export interface CaptureOptions {
tags?: { string: string }; // Additional tags to assign to each event. E.g. {git_commit: 'c0deb10c4'}
extra?: { string: string }; // Arbitrary data to associate with the event.
fingerprint?: string; // The fingerprint for grouping this event.
level?: string; // The level of the event. Defaults to error.
}
}
declare module "raven" {
export = raven;
}
A big reason we added TypeScript support for Raven.js is because Angular 2 uses TypeScript by default, which is an officially supported framework.
Since there are externally available d.ts
files out there, I'm going to keep this on hold until we get more support / votes.
@benvinegar unless I'm mistaken, you linked to a 3rd party d.ts
file for raven-js
(which is obsoleted by getsentry/raven-js#610)
AFAIK there is no community d.ts
files for raven-node
on DefinitelyTyped, and no submissions under review which makes the issue raised here more acute.
At the very least, as a community we should try and get a solid definition file submitted to DT? @thesmart seems like you have made a good start there!
Just adding my +1 for this, we'd appreciate typings available via @types/raven-node .
more and more people use typescript
+1
I'm going to leave my +1 here since there's no voting mechanism around here.
+1
+1
+1
Please!!
this can't be so difficult as to take it a year to implement... or can it? :-O
Its not, but its an open source software so we can provide a PR if we think it take too much time to implement :-)
Ouch @martinambrus! Now there is the https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/raven but it would be cool to be shipped here and maintained ... I am happy to migrate and start the process. Just need help maintaining once it is here. Best done by the release team but I am happy to do the initial leg work
this can't be so difficult as to take it a year to implement... or can it? :-O
We had a lot of grief maintaining TypeScript bindings for raven-js. It has been a serious maintenance burden, because people don't often contribute towards them (for example, nobody in this thread has contributed a PR). It's hard to commit to doing them when we don't write TypeScript ourselves.
(Not saying this is a hard no, I can be convinced, but we're low on maintenance resources right now so it's not going to happen any time in the next few months without community help.)
@benvinegar Would you prefer me leave them in DT? I am cool either way and can at least update to the 2.1 release ... right now it is at 1.2 so shouldnt be too time consuming to update the signatures and add what is missing. Let me know how you want me to proceed!
@jpinkster let me know if you decide to do it, or else I'll make a PR myself in the next weeks
@benvinegar, @jpinkster thanks for the update guys... if my comment seemed negative, I apologize but not seeing any response from the developers led me to think they just ignore us... very glad it's not the case :)
@jpinkster @alfaproject still interested in writing those definitions?
What is the status of this issue ?
It's still open for contributions. Unfortunately I'm not any good with TS and don't have enough time to tackle this issue.
The
raven-js
library for browsers got TypeScript definitions in https://github.com/getsentry/raven-js/pull/610, but those definitions cannot be used for the nodejs library.The definitions should be implemented for this version as well.