Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
"source.fixAll.eslint": "never"
},
"files.trimTrailingWhitespace": true,
"prettier.useEditorConfig": false
"prettier.useEditorConfig": false,
"typescript.tsdk": "node_modules/typescript/lib"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tell vscode to use the sdk's typescript.

}
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export default defineConfig(

// disabled for now
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-nocheck': false }],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary until all new TS tests are migrated

},
},

Expand Down
5 changes: 5 additions & 0 deletions examples/react-19-ts-components/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ function App() {
accessToken: 'POST_CLIENT_ITEM_TOKEN',
captureUncaught: true,
captureUnhandledRejections: true,
person: {
id: '12345',
name: 'Test User',
email: '[email protected]',
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't working before this update.

}));

const logInfo = () => {
Expand Down
35 changes: 28 additions & 7 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

export default Rollbar;

declare class Rollbar {
declare class Rollbar implements Rollbar.Components {
constructor(options?: Rollbar.Configuration);
static init(options: Rollbar.Configuration): Rollbar;
static setComponents(components: Rollbar.Components): void;
Expand Down Expand Up @@ -34,12 +34,30 @@ declare class Rollbar {

public errorHandler(): Rollbar.ExpressErrorHandler;

// Components

public telemeter?: TelemeterType;
public instrumenter?: InstrumenterType;
public wrapGlobals?: WrapGlobalsType;
public scrub?: ScrubType;
public truncation?: TruncationType;
public tracing?: TracingType;
/**
* Replay component for session recording.
* Only available when using replay bundles (rollbar.replay.*).
* Use `import Rollbar from 'rollbar/replay'` to access.
*/
public replay?: ReplayType;
Comment on lines +37 to +50
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't find a way not to repeat this from Rollbar.Components here.


// Used with rollbar-react for rollbar-react-native compatibility.
public rollbar: Rollbar;

// Exposed only for testing, should be changed via the configure method
// DO NOT MODIFY DIRECTLY
public options: Rollbar.Configuration;

// Exposed only for testing, tracks pending anonymous errors
anonymousErrorsPending: number;
}

declare namespace Rollbar {
Expand Down Expand Up @@ -111,6 +129,7 @@ declare namespace Rollbar {
) => void;
overwriteScrubFields?: boolean;
payload?: Payload;
person?: PersonParams;
replay?: ReplayOptions;
reportLevel?: Level;
resource?: StringAttributes;
Expand Down Expand Up @@ -311,6 +330,13 @@ declare namespace Rollbar {
transformSpan?: (params: TransformSpanParams) => void;
}

export interface PersonParams {
id: string | DeprecatedNumber | null;
username?: string;
email?: string;
[property: string]: any;
}

/**
* @deprecated number is deprecated for this field
*/
Expand All @@ -320,12 +346,7 @@ declare namespace Rollbar {
* {@link https://docs.rollbar.com/docs/rollbarjs-configuration-reference#payload-1}
*/
export interface Payload {
person?: {
id: string | DeprecatedNumber | null;
username?: string;
email?: string;
[property: string]: any;
};
person?: PersonParams;
context?: any;
client?: {
javascript?: {
Expand Down
123 changes: 70 additions & 53 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@
"@babel/preset-typescript": "^7.28.5",
"@types/chai": "^4.3.20",
"@types/mocha": "^10.0.10",
"@types/nise": "^1.4.5",
"@types/node": "^20.17.12",
"@types/sinon": "^10.0.20",
"@types/sinon": "^21.0.0",
"@web/dev-server-esbuild": "^1.0.4",
"@web/test-runner": "^0.20.2",
"@web/test-runner-mocha": "^0.9.0",
Expand All @@ -116,10 +117,11 @@
"glob": "^5.0.14",
"globals": "^16.5.0",
"mocha": "^11.1.0",
"nise": "^6.1.1",
"nock": "^11.9.1",
"node-libs-browser": "^0.5.2",
"prettier": "^3.6.2",
"sinon": "^8.1.1",
"sinon": "^21.0.0",
Comment on lines +120 to +124
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to keep the old sinon version but I couldn't, then starting sinon 9+, creating fake servers is done using their library called nise.

"ts-node": "^10.9.2",
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.4",
Expand Down
Loading