Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "parse-server-kit",
"version": "3.0.4",
"version": "3.0.5",
"description": "Decorator-driven toolkit for Parse Server: models, cloud functions, triggers, cron, REST routing, ACL, transactions, optimistic locking and Swagger, from TypeScript decorators.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
20 changes: 18 additions & 2 deletions templates/default/src/note.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,24 @@ import {test, describe} from 'node:test';
import assert from 'node:assert/strict';

import './env';
import Parse from 'parse/node';
(global as unknown as {Parse: typeof Parse}).Parse = Parse;

/*
* `require`, not `import`.
*
* The SDK has to be on the global before a model is imported, because
* `@ParseClass` registers the subclass while the module is being evaluated.
*
* A typed `import Parse from 'parse/node'` would do that too — but it also
* pulls in the type definitions the `parse` package ships, which disagree with
* `@types/parse` that the rest of the project uses. `getSessionToken()` is
* `string` in one and `string | null` in the other, and having both in a
* project produces errors that point at your code rather than at the clash.
*
* Requiring it sets the global without introducing a second source of types,
* so `Parse` here means the same thing it means everywhere else.
*/
// eslint-disable-next-line @typescript-eslint/no-var-requires
(global as unknown as {Parse: unknown}).Parse = require('parse/node');

import Note from './models/Note';

Expand Down
Loading