mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-19 14:13:48 +01:00
fix any in NetscriptPort
This commit is contained in:
parent
5c3ecb9a23
commit
610bcd6315
@ -11,10 +11,10 @@ export interface IPort {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function NetscriptPort(): IPort {
|
export function NetscriptPort(): IPort {
|
||||||
const data: any[] = [];
|
const data: unknown[] = [];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
write: (value: any): any => {
|
write: (value: unknown): unknown => {
|
||||||
data.push(value);
|
data.push(value);
|
||||||
if (data.length > Settings.MaxPortCapacity) {
|
if (data.length > Settings.MaxPortCapacity) {
|
||||||
return data.shift();
|
return data.shift();
|
||||||
@ -22,7 +22,7 @@ export function NetscriptPort(): IPort {
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
tryWrite: (value: any): boolean => {
|
tryWrite: (value: unknown): boolean => {
|
||||||
if (data.length >= Settings.MaxPortCapacity) {
|
if (data.length >= Settings.MaxPortCapacity) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -30,14 +30,14 @@ export function NetscriptPort(): IPort {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
read: (): any => {
|
read: (): unknown => {
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
return "NULL PORT DATA";
|
return "NULL PORT DATA";
|
||||||
}
|
}
|
||||||
return data.shift();
|
return data.shift();
|
||||||
},
|
},
|
||||||
|
|
||||||
peek: (): any => {
|
peek: (): unknown => {
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
return "NULL PORT DATA";
|
return "NULL PORT DATA";
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user