Skip to content

Commit 6b32481

Browse files
committed
fix: use Record<string, any> instead of {}
1 parent 6d559af commit 6b32481

6 files changed

+21
-21
lines changed

lib/decoration-management.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export default class DecorationManagement {
236236
* highlight-outine decorations at a given
237237
* row
238238
*/
239-
decorationsByTypeThenRows(): {} {
239+
decorationsByTypeThenRows(): Record<string, any> {
240240
if (this.decorationsByTypeThenRowsCache != null) {
241241
return this.decorationsByTypeThenRowsCache
242242
}
@@ -481,7 +481,7 @@ export default class DecorationManagement {
481481
* change object
482482
* @access private
483483
*/
484-
emitRangeChanges(type: string, range: {}, screenDelta) {
484+
emitRangeChanges(type: string, range: Record<string, any>, screenDelta) {
485485
const startScreenRow = range.start.row
486486
const endScreenRow = range.end.row
487487
const lastRenderedScreenRow = this.minimap.getLastVisibleScreenRow()

lib/decoration.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default class Decoration {
2121
* @param {string} type the decoration type to match
2222
* @return {boolean} whether the decoration properties match the type
2323
*/
24-
static isType(decorationProperties: {}, type: string): boolean {
24+
static isType(decorationProperties: Record<string, any>, type: string): boolean {
2525
if (Array.isArray(decorationProperties.type)) {
2626
if (decorationProperties.type.indexOf(type) >= 0) {
2727
return true
@@ -40,7 +40,7 @@ export default class Decoration {
4040
* be displayed
4141
* @param {Object} properties the decoration's properties
4242
*/
43-
constructor(marker: Marker, minimap: Minimap, properties: {}) {
43+
constructor(marker: Marker, minimap: Minimap, properties: Record<string, any>) {
4444
/**
4545
* @access private
4646
*/
@@ -119,7 +119,7 @@ export default class Decoration {
119119
* when the event is triggered
120120
* @return {Disposable} a disposable to stop listening to the event
121121
*/
122-
onDidChangeProperties(callback: (change: {}) => void): Disposable {
122+
onDidChangeProperties(callback: (change: Record<string, any>) => void): Disposable {
123123
return this.emitter.on("did-change-properties", callback)
124124
}
125125

@@ -170,7 +170,7 @@ export default class Decoration {
170170
*
171171
* @return {Object} the decoration's properties
172172
*/
173-
getProperties(): {} {
173+
getProperties(): Record<string, any> {
174174
return this.properties
175175
}
176176

@@ -180,7 +180,7 @@ export default class Decoration {
180180
*
181181
* @param {Object} newProperties the new properties for the decoration
182182
*/
183-
setProperties(newProperties: {}) {
183+
setProperties(newProperties: Record<string, any>) {
184184
if (this.destroyed) {
185185
return
186186
}

lib/minimap-element.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ function extractTouchEventData(touchEvent: TouchEvent) {
14101410
* @param {Object} styles the styles to apply
14111411
* @access private
14121412
*/
1413-
function applyStyles(element: HTMLElement, styles: {}) {
1413+
function applyStyles(element: HTMLElement, styles: Record<string, any>) {
14141414
if (!element) {
14151415
return
14161416
}

lib/minimap.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ export default class Minimap {
10861086
* @param {Object} changes a change to dispatch
10871087
* @access private
10881088
*/
1089-
emitChanges(changes: {}) {
1089+
emitChanges(changes: Record<string, any>) {
10901090
this.emitter.emit("did-change", changes)
10911091
}
10921092

lib/mixins/canvas-drawer.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ const frontDecorationDispatcher = {
818818
* @param {string} decorationColor decoration color
819819
* @access private
820820
*/
821-
function drawLineDecoration(decoration: Decoration, data: {}, decorationColor: string) {
821+
function drawLineDecoration(decoration: Decoration, data: Record<string, any>, decorationColor: string) {
822822
const { context, lineHeight, canvasWidth, yRow } = data
823823

824824
context.fillStyle = decorationColor
@@ -833,7 +833,7 @@ function drawLineDecoration(decoration: Decoration, data: {}, decorationColor: s
833833
* @param {string} decorationColor decoration color
834834
* @access private
835835
*/
836-
function drawGutterDecoration(decoration: Decoration, data: {}, decorationColor: string) {
836+
function drawGutterDecoration(decoration: Decoration, data: Record<string, any>, decorationColor: string) {
837837
const { context, lineHeight, yRow } = data
838838

839839
context.fillStyle = decorationColor
@@ -851,7 +851,7 @@ function drawGutterDecoration(decoration: Decoration, data: {}, decorationColor:
851851
* @param {string} decorationColor decoration color
852852
* @access private
853853
*/
854-
function drawHighlightDecoration(decoration: Decoration, data: {}, decorationColor: string) {
854+
function drawHighlightDecoration(decoration: Decoration, data: Record<string, any>, decorationColor: string) {
855855
const { context, lineHeight, charWidth, canvasWidth, screenRow, yRow } = data
856856

857857
const range = decoration.getMarker().getScreenRange()
@@ -883,7 +883,7 @@ function drawHighlightDecoration(decoration: Decoration, data: {}, decorationCol
883883
* @param {string} decorationColor decoration color
884884
* @access private
885885
*/
886-
function drawHighlightOutlineDecoration(decoration: Decoration, data: {}, decorationColor: string) {
886+
function drawHighlightOutlineDecoration(decoration: Decoration, data: Record<string, any>, decorationColor: string) {
887887
const { context, lineHeight, charWidth, canvasWidth, screenRow, yRow } = data
888888

889889
let bottomWidth, colSpan, width, xBottomStart, xEnd, xStart
@@ -968,7 +968,7 @@ function drawHighlightOutlineDecoration(decoration: Decoration, data: {}, decora
968968
*/
969969
function drawCustomDecoration(
970970
decoration: Decoration,
971-
data: {},
971+
data: Record<string, any>,
972972
decorationColor: string,
973973
editorElement: TextEditorElement
974974
) {
@@ -997,9 +997,9 @@ function drawCustomDecoration(
997997
*/
998998
function drawDecorations(
999999
screenRow: number,
1000-
decorations: {},
1001-
renderData: {},
1002-
types: {},
1000+
decorations: Record<string, any>,
1001+
renderData: Record<string, any>,
1002+
types: Record<string, any>,
10031003
editorElement: TextEditorElement
10041004
) {
10051005
let decorationsToRender = []
@@ -1061,7 +1061,7 @@ function drawFrontDecorationsForLines(
10611061
firstRow: number,
10621062
lastRow: number,
10631063
offsetRow: number,
1064-
renderData: {},
1064+
renderData: Record<string, any>,
10651065
lineHeight: number,
10661066
editorElement: TextEditorElement,
10671067
decorations: Array<Decoration>
@@ -1102,7 +1102,7 @@ function drawBackDecorationsForLines(
11021102
firstRow: number,
11031103
lastRow: number,
11041104
offsetRow: number,
1105-
renderData: {},
1105+
renderData: Record<string, any>,
11061106
lineHeight: number,
11071107
editorElement: TextEditorElement,
11081108
decorations: Array<Decoration>

lib/plugin-management.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ export const plugins = {}
3434
* @type {Object}
3535
* @access private
3636
*/
37-
const pluginsSubscriptions: {} = {}
37+
const pluginsSubscriptions: Record<string, any> = {}
3838

3939
/**
4040
* A map that stores the display order for each plugin
4141
*
4242
* @type {Object}
4343
* @access private
4444
*/
45-
const pluginsOrderMap: {} = {}
45+
const pluginsOrderMap: Record<string, any> = {}
4646

4747
/**
4848
* Registers a minimap `plugin` with the given `name`.

0 commit comments

Comments
 (0)