Skip to content

Commit

Permalink
Merge pull request #313 from derbyjs/fix-racer-2.2.0
Browse files Browse the repository at this point in the history
Fixes for TS type issues introduced in racer@2.2.0 / TS 5.5
  • Loading branch information
ericyhwang authored Jul 22, 2024
2 parents 3c7a014 + db2917c commit a20e9d2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
"eslint-config-google": "^0.14.0",
"mocha": "^9.1.3",
"nyc": "^15.1.0",
"typedoc": "^0.25.13",
"typedoc": "^0.26.5",
"typedoc-plugin-mdn-links": "^3.1.28",
"typedoc-plugin-missing-exports": "^2.2.0",
"typescript": "^5.1.3"
"typedoc-plugin-missing-exports": "^3.0.0",
"typescript": "~5.5"
},
"bugs": {
"url": "https://github.com/derbyjs/racer/issues"
Expand Down
4 changes: 2 additions & 2 deletions src/Model/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// <reference path="./bundle.ts" />
/// <reference path="./connection.server.ts" />
/// <reference path="./bundle.ts" preserve="true" />
/// <reference path="./connection.server.ts" preserve="true" />

import { serverRequire } from '../util';
export { Model, ChildModel, RootModel, type ModelOptions, type UUID, type DefualtType } from './Model';
Expand Down
6 changes: 4 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,18 @@ export function serverUse(module, id: string, options?: unknown) {
return this.use(plugin, options);
}

type Plugin<T extends {}, O> = (pluginHost: T, options: O) => void;

/**
* Use plugin
*
* @param plugin
* @param options - Optional options passed to plugin
* @returns
*/
export function use(plugin: (arg0: unknown, options?: unknown) => void, options?: unknown) {
export function use<T extends {}, O>(this: T, plugin: Plugin<T, O>, options?: O) {
// Don't include a plugin more than once
var plugins = this._plugins || (this._plugins = []);
var plugins = (this as any)._plugins || ((this as any)._plugins = []);
if (plugins.indexOf(plugin) === -1) {
plugins.push(plugin);
plugin(this, options);
Expand Down
2 changes: 0 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"compilerOptions": {
"allowJs": true,
"ignoreDeprecations": "5.0",
"lib":[],
"module": "CommonJS",
"noImplicitUseStrict": true,
"outDir": "lib",
"target": "ES5",
"sourceMap": false,
Expand Down

0 comments on commit a20e9d2

Please sign in to comment.