Legal Return Types

本文详细介绍了Java中原始类型的合法返回类型,包括boolean、char、int等整型及浮点数的规则,并解释了32位浮点数如何能够存储64位整数的情况。此外,还探讨了对象类型返回值的合法性及其灵活性。

Return Primitive Types

boolean: the only type of value that can be returned is a boolean literal such as true or false. Java will not accept a boolean object, null, an integer value such as 0 or 1, or any other type.

char: a char is a 16-bit value that ranges from 0 to 65535. This meas some (but not all) integral types are legal return types for char. A negative integral number, or an integral larger than 65535 is not legal.

A good way to determine whether an integral return type is legal is to think of the number of bits that a primitive can hold. If the bits value of the return type is less than the declared return type, it is legal.

Legal Return Types for Integer and Floating-Point Numbers
Declared TypeLegal Return Type
bytebyte
shortbyte, short
intbyte, short, int, char
longbyte, short, int, long, char
floatbyte, short, int, long, float, char
doublebyte, short, int, long, float, double, char

How can a 32-bit float is capable of storing a 64-bit integer?

When float numbers get very large they begin to use exponential numbers.  if there are 19 individual digits in single number, it will give you a number x1018. No accuracy is lost with this small of a number, however. But for larger numbers, the large float loses some accuracy.

class AccuracyTest {

public static void main(String [] args) {

  long salary = Long.MAX_VALUE - 443322112233L;

  System.out.println("long is " + salary);

  float taxes = salary;

  System.out.println("float is " + taxes);

  long net = (long) taxes;

  System.out.println("New long is " + net);

}

}

for this program, the result is:

long is 9223371593532663574
float is 9.2233715E18
New long is 9223371487098961920

So float can handle large numbers, but as a banker or mathematician you would have to doubt these results. A better solution would be to use java.math.BigInteger or java.math.BigDecimal. These classes are slower to use, but they have no upper limit on numbers, and they provide most of the methods contained in the java.lang.Math class.

It is illegal for a primitive to be assigned to null. In other words, if a method declares a primitive return type, then the method may not attempt to return null.

 Object Return Types

 A method with an object return type can return the same object type, or subclass of the object, or null value.

It is also legal to have a return type that is an interface. For example, a method can use Runnable as its return type even though a Thread object is being returned. This is because Thread implements the Runnable interface.

node_modules/@types/electron/index.d.ts:8:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: Event, Point, Size, Rectangle, BrowserWindow, MenuItem, Menu, NativeImage, ClientRequest, Session, Tray, electron 8 declare namespace Electron { ~~~~~~~ node_modules/electron/electron.d.ts:8:1 8 type DOMEvent = Event; ~~~~ Conflicts are in this file. node_modules/@types/electron/index.d.ts:449:3 - error TS2687: All declarations of 'commandLine' must have identical modifiers. 449 commandLine: CommandLine; ~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:453:3 - error TS2687: All declarations of 'dock' must have identical modifiers. 453 dock: Dock; ~~~~ node_modules/@types/electron/index.d.ts:572:3 - error TS2687: All declarations of 'description' must have identical modifiers. 572 description?: string; ~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:584:3 - error TS2687: All declarations of 'iconIndex' must have identical modifiers. 584 iconIndex?: number; ~~~~~~~~~ node_modules/@types/electron/index.d.ts:634:3 - error TS2687: All declarations of 'type' must have identical modifiers. 634 type: 'task' | 'separator' | 'file'; ~~~~ node_modules/@types/electron/index.d.ts:682:3 - error TS2687: All declarations of 'wasOpenedAtLogin' must have identical modifiers. 682 wasOpenedAtLogin?: boolean; ~~~~~~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:687:3 - error TS2687: All declarations of 'wasOpenedAsHidden' must have identical modifiers. 687 wasOpenedAsHidden?: boolean; ~~~~~~~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:693:3 - error TS2687: All declarations of 'restoreState' must have identical modifiers. 693 restoreState?: boolean; ~~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:773:30 - error TS2689: Cannot extend an interface 'NodeJS.EventEmitter'. Did you mean 'implements'? 773 class BrowserWindow extends NodeJS.EventEmitter implements Destroyable { ~~~~~~ node_modules/@types/electron/index.d.ts:1410:3 - error TS2717: Subsequent property declarations must have the same type. Property 'icon' must be of type 'NativeImage', but here has type 'string | NativeImage'. 1410 icon: NativeImage | string; ~~~~ node_modules/electron/electron.d.ts:13555:5 13555 icon: NativeImage; ~~~~ 'icon' was also declared here. node_modules/@types/electron/index.d.ts:1411:3 - error TS2717: Subsequent property declarations must have the same type. Property 'click' must be of type '() => void', but here has type 'Function'. 1411 click: Function; ~~~~~ node_modules/electron/electron.d.ts:13546:5 13546 click: () => void; ~~~~~ 'click' was also declared here. node_modules/@types/electron/index.d.ts:1413:3 - error TS2717: Subsequent property declarations must have the same type. Property 'flags' must be of type 'string[]', but here has type 'ThumbarButtonFlags[]'. 1413 flags?: ThumbarButtonFlags[]; ~~~~~ node_modules/electron/electron.d.ts:13551:5 13551 flags?: string[]; ~~~~~ 'flags' was also declared here. node_modules/@types/electron/index.d.ts:1542:3 - error TS2717: Subsequent property declarations must have the same type. Property 'defaultFontFamily' must be of type 'DefaultFontFamily', but here has type '{ standard?: string; serif?: string; sansSerif?: string; monospace?: string; }'. 1542 defaultFontFamily?: { ~~~~~~~~~~~~~~~~~ node_modules/electron/electron.d.ts:18315:5 18315 defaultFontFamily?: DefaultFontFamily; ~~~~~~~~~~~~~~~~~ 'defaultFontFamily' was also declared here. node_modules/@types/electron/index.d.ts:1585:3 - error TS2717: Subsequent property declarations must have the same type. Property 'offscreen' must be of type 'boolean | Offscreen', but here has type 'boolean'. 1585 offscreen?: boolean; ~~~~~~~~~ node_modules/electron/electron.d.ts:18413:5 18413 offscreen?: (Offscreen) | (boolean); ~~~~~~~~~ 'offscreen' was also declared here. node_modules/@types/electron/index.d.ts:2041:3 - error TS2687: All declarations of 'companyName' must have identical modifiers. 2041 companyName: string; ~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:2045:3 - error TS2687: All declarations of 'submitURL' must have identical modifiers. 2045 submitURL: string; ~~~~~~~~~ node_modules/@types/electron/index.d.ts:2194:3 - error TS2717: Subsequent property declarations must have the same type. Property 'properties' must be of type '("openFile" | "openDirectory" | "multiSelections" | "showHiddenFiles" | "createDirectory" | "promptToCreate" | "noResolveAliases" | "treatPackageAsDirectory" | "dontAddToRecent")[]', but here has type '("openFile" | "openDirectory" | "multiSelections" | "showHiddenFiles" | "createDirectory" | "promptToCreate" | "noResolveAliases")[]'. 2194 properties?: ('openFile' | 'openDirectory' | 'multiSelections' | 'createDirectory' | 'showHiddenFiles' | 'promptToCreate' | 'noResolveAliases')[]; ~~~~~~~~~~ node_modules/electron/electron.d.ts:21666:5 21666 properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>; ~~~~~~~~~~ 'properties' was also declared here. node_modules/@types/electron/index.d.ts:2415:3 - error TS2687: All declarations of 'returnValue' must have identical modifiers. 2415 returnValue?: any; ~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:2622:21 - error TS2689: Cannot extend an interface 'NodeJS.EventEmitter'. Did you mean 'implements'? 2622 class Menu extends NodeJS.EventEmitter { ~~~~~~ node_modules/@types/electron/index.d.ts:2835:30 - error TS2689: Cannot extend an interface 'NodeJS.EventEmitter'. Did you mean 'implements'? 2835 class ClientRequest extends NodeJS.EventEmitter { ~~~~~~ node_modules/@types/electron/index.d.ts:2973:3 - error TS2717: Subsequent property declarations must have the same type. Property 'headers' must be of type 'Record<string, string | string[]>', but here has type '{ [key: string]: string[]; }'. 2973 headers: { ~~~~~~~ node_modules/electron/electron.d.ts:8601:5 8601 headers: Record<string, (string) | (string[])>; ~~~~~~~ 'headers' was also declared here. node_modules/@types/electron/index.d.ts:3110:3 - error TS2717: Subsequent property declarations must have the same type. Property 'uploadData' must be of type 'UploadData[]', but here has type '{ bytes: Buffer<ArrayBufferLike>; file: string; blobUUID: string; }[]'. 3110 uploadData?: { ~~~~~~~~~~ node_modules/electron/electron.d.ts:11150:5 11150 uploadData?: UploadData[]; ~~~~~~~~~~ 'uploadData' was also declared here. node_modules/@types/electron/index.d.ts:3276:24 - error TS2689: Cannot extend an interface 'NodeJS.EventEmitter'. Did you mean 'implements'? 3276 class Session extends NodeJS.EventEmitter { ~~~~~~ node_modules/@types/electron/index.d.ts:3388:3 - error TS2687: All declarations of 'cache' must have identical modifiers. 3388 cache?: boolean; ~~~~~ node_modules/@types/electron/index.d.ts:3399:3 - error TS2717: Subsequent property declarations must have the same type. Property 'storages' must be of type '("cookies" | "filesystem" | "indexdb" | "localstorage" | "shadercache" | "websql" | "serviceworkers" | "cachestorage")[]', but here has type '("cookies" | "filesystem" | "indexdb" | "localstorage" | "shadercache" | "websql" | "serviceworkers" | "appcache")[]'. 3399 storages?: ('appcache' | 'cookies' | 'filesystem' | 'indexdb' | 'localstorage' | 'shadercache' | 'websql' | 'serviceworkers')[]; ~~~~~~~~ node_modules/electron/electron.d.ts:19654:5 19654 storages?: Array<'cookies' | 'filesystem' | 'indexdb' | 'localstorage' | 'shadercache' | 'websql' | 'serviceworkers' | 'cachestorage'>; ~~~~~~~~ 'storages' was also declared here. node_modules/@types/electron/index.d.ts:3403:3 - error TS2717: Subsequent property declarations must have the same type. Property 'quotas' must be of type '"temporary"[]', but here has type '("temporary" | "persistent" | "syncable")[]'. 3403 quotas?: ('temporary' | 'persistent' | 'syncable')[]; ~~~~~~ node_modules/electron/electron.d.ts:19659:5 19659 quotas?: Array<'temporary'>; ~~~~~~ 'quotas' was also declared here. node_modules/@types/electron/index.d.ts:3410:3 - error TS2687: All declarations of 'pacScript' must have identical modifiers. 3410 pacScript: string; ~~~~~~~~~ node_modules/@types/electron/index.d.ts:3414:3 - error TS2687: All declarations of 'proxyRules' must have identical modifiers. 3414 proxyRules: string; ~~~~~~~~~~ node_modules/@types/electron/index.d.ts:3418:3 - error TS2687: All declarations of 'proxyBypassRules' must have identical modifiers. 3418 proxyBypassRules: string; ~~~~~~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:3488:3 - error TS2687: All declarations of 'domain' must have identical modifiers. 3488 domain: string; ~~~~~~ node_modules/@types/electron/index.d.ts:3492:3 - error TS2687: All declarations of 'hostOnly' must have identical modifiers. 3492 hostOnly: string; ~~~~~~~~ node_modules/@types/electron/index.d.ts:3492:3 - error TS2717: Subsequent property declarations must have the same type. Property 'hostOnly' must be of type 'boolean', but here has type 'string'. 3492 hostOnly: string; ~~~~~~~~ node_modules/electron/electron.d.ts:7000:5 7000 hostOnly?: boolean; ~~~~~~~~ 'hostOnly' was also declared here. node_modules/@types/electron/index.d.ts:3496:3 - error TS2687: All declarations of 'path' must have identical modifiers. 3496 path: string; ~~~~ node_modules/@types/electron/index.d.ts:3500:3 - error TS2687: All declarations of 'secure' must have identical modifiers. 3500 secure: boolean; ~~~~~~ node_modules/@types/electron/index.d.ts:3504:3 - error TS2687: All declarations of 'httpOnly' must have identical modifiers. 3504 httpOnly: boolean; ~~~~~~~~ node_modules/@types/electron/index.d.ts:3508:3 - error TS2687: All declarations of 'session' must have identical modifiers. 3508 session: boolean; ~~~~~~~ node_modules/@types/electron/index.d.ts:3997:21 - error TS2689: Cannot extend an interface 'NodeJS.EventEmitter'. Did you mean 'implements'? 3997 class Tray extends NodeJS.EventEmitter implements Destroyable { ~~~~~~ node_modules/@types/electron/index.d.ts:4704:3 - error TS2687: All declarations of 'id' must have identical modifiers. 4704 id: number; ~~ node_modules/@types/electron/index.d.ts:4708:3 - error TS2687: All declarations of 'session' must have identical modifiers. 4708 session: Session; ~~~~~~~ node_modules/@types/electron/index.d.ts:4712:3 - error TS2687: All declarations of 'hostWebContents' must have identical modifiers. 4712 hostWebContents: WebContents; ~~~~~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:4718:3 - error TS2687: All declarations of 'devToolsWebContents' must have identical modifiers. 4718 devToolsWebContents: WebContents; ~~~~~~~~~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:4722:3 - error TS2687: All declarations of 'debugger' must have identical modifiers. 4722 debugger: Debugger; ~~~~~~~~ node_modules/@types/electron/index.d.ts:4780:3 - error TS2717: Subsequent property declarations must have the same type. Property 'mediaFlags' must be of type 'MediaFlags', but here has type '{ inError: boolean; isPaused: boolean; isMuted: boolean; hasAudio: boolean; isLooping: boolean; isControlsVisible: boolean; canToggleControls: boolean; canRotate: boolean; }'. 4780 mediaFlags: { ~~~~~~~~~~ node_modules/electron/electron.d.ts:20039:5 20039 mediaFlags: MediaFlags; ~~~~~~~~~~ 'mediaFlags' was also declared here. node_modules/@types/electron/index.d.ts:4825:3 - error TS2717: Subsequent property declarations must have the same type. Property 'editFlags' must be of type 'EditFlags', but here has type '{ canUndo: boolean; canRedo: boolean; canCut: boolean; canCopy: boolean; canPaste: boolean; canDelete: boolean; canSelectAll: boolean; }'. 4825 editFlags: { ~~~~~~~~~ node_modules/electron/electron.d.ts:20044:5 20044 editFlags: EditFlags; ~~~~~~~~~ 'editFlags' was also declared here. node_modules/@types/electron/index.d.ts:4878:3 - error TS2717: Subsequent property declarations must have the same type. Property 'menuSourceType' must be of type '"none" | "stylus" | "mouse" | "keyboard" | "touch" | "touchMenu" | "longPress" | "longTap" | "touchHandle" | "adjustSelection" | "adjustSelectionReset"', but here has type '"none" | "mouse" | "keyboard" | "touch" | "touchMenu"'. 4878 menuSourceType: 'none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu'; ~~~~~~~~~~~~~~ node_modules/electron/electron.d.ts:20035:5 20035 menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu' | 'longPress' | 'longTap' | 'touchHandle' | 'stylus' | 'adjustSelection' | 'adjustSelectionReset'); ~~~~~~~~~~~~~~ 'menuSourceType' was also declared here. node_modules/@types/electron/index.d.ts:4906:3 - error TS2717: Subsequent property declarations must have the same type. Property 'httpReferrer' must be of type 'string | Referrer', but here has type 'string'. 4906 httpReferrer?: string; ~~~~~~~~~~~~ node_modules/electron/electron.d.ts:20916:5 20916 httpReferrer?: (string) | (Referrer); ~~~~~~~~~~~~ 'httpReferrer' was also declared here. node_modules/@types/electron/index.d.ts:4918:3 - error TS2717: Subsequent property declarations must have the same type. Property 'postData' must be of type '(UploadRawData | UploadFile)[]', but here has type '(UploadRawData | UploadFileSystem | UploadBlob)[]'. 4918 postData?: (UploadRawData | UploadFileSystem | UploadBlob)[]; ~~~~~~~~ node_modules/electron/electron.d.ts:20925:5 20925 postData?: Array<(UploadRawData) | (UploadFile)>; ~~~~~~~~ 'postData' was also declared here. node_modules/@types/electron/index.d.ts:4992:3 - error TS2717: Subsequent property declarations must have the same type. Property 'pageSize' must be of type 'Size | "A0" | "A1" | "A2" | "A3" | "A4" | "A5" | "A6" | "Legal" | "Letter" | "Tabloid" | "Ledger"', but here has type 'Size | "A3" | "A4" | "A5" | "Legal" | "Letter" | "Tabloid"'. 4992 pageSize?: 'A3' | 'A4' | 'A5' | 'Legal' | 'Letter' | 'Tabloid' | Size; ~~~~~~~~ node_modules/electron/electron.d.ts:21956:5 21956 pageSize?: (('A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'Legal' | 'Letter' | 'Tabloid' | 'Ledger')) | (Size); ~~~~~~~~ 'pageSize' was also declared here. node_modules/@types/electron/index.d.ts:5128:3 - error TS2687: All declarations of 'activeMatchOrdinal' must have identical modifiers. 5128 activeMatchOrdinal?: number; ~~~~~~~~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:5132:3 - error TS2687: All declarations of 'matches' must have identical modifiers. 5132 matches?: number; ~~~~~~~ node_modules/@types/electron/index.d.ts:5136:3 - error TS2687: All declarations of 'selectionArea' must have identical modifiers. 5136 selectionArea?: Rectangle; ~~~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:6035:3 - error TS2687: All declarations of 'electron' must have identical modifiers. 6035 electron: string; ~~~~~~~~ node_modules/@types/electron/index.d.ts:6039:3 - error TS2687: All declarations of 'chrome' must have identical modifiers. 6039 chrome: string; ~~~~~~ node_modules/@types/electron/index.d.ts:6046:3 - error TS2687: All declarations of 'noAsar' must have identical modifiers. 6046 noAsar?: boolean; ~~~~~~ node_modules/@types/electron/index.d.ts:6050:3 - error TS2687: All declarations of 'type' must have identical modifiers. 6050 type: 'browser' | 'renderer'; ~~~~ node_modules/@types/electron/index.d.ts:6050:3 - error TS2717: Subsequent property declarations must have the same type. Property 'type' must be of type '"worker" | "browser" | "service-worker" | "renderer" | "utility"', but here has type '"browser" | "renderer"'. 6050 type: 'browser' | 'renderer'; ~~~~ node_modules/electron/electron.d.ts:25720:14 25720 readonly type: ('browser' | 'renderer' | 'service-worker' | 'worker' | 'utility'); ~~~~ 'type' was also declared here. node_modules/@types/electron/index.d.ts:6054:3 - error TS2687: All declarations of 'resourcesPath' must have identical modifiers. 6054 resourcesPath: string; ~~~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:6058:3 - error TS2687: All declarations of 'mas' must have identical modifiers. 6058 mas?: boolean; ~~~ node_modules/@types/electron/index.d.ts:6062:3 - error TS2687: All declarations of 'windowsStore' must have identical modifiers. 6062 windowsStore?: boolean; ~~~~~~~~~~~~ node_modules/@types/electron/index.d.ts:6067:3 - error TS2687: All declarations of 'defaultApp' must have identical modifiers. 6067 defaultApp?: boolean; ~~~~~~~~~~ node_modules/electron/electron.d.ts:8:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: Event, Point, Size, Rectangle, BrowserWindow, MenuItem, Menu, NativeImage, ClientRequest, Session, Tray, electron 8 type DOMEvent = Event; ~~~~ node_modules/@types/electron/index.d.ts:8:1 8 declare namespace Electron { ~~~~~~~ Conflicts are in this file. node_modules/electron/electron.d.ts:1841:14 - error TS2687: All declarations of 'commandLine' must have identical modifiers. 1841 readonly commandLine: CommandLine; ~~~~~~~~~~~ node_modules/electron/electron.d.ts:1849:14 - error TS2687: All declarations of 'dock' must have identical modifiers. 1849 readonly dock: (Dock) | (undefined); ~~~~ node_modules/electron/electron.d.ts:6990:5 - error TS2687: All declarations of 'domain' must have identical modifiers. 6990 domain?: string; ~~~~~~ node_modules/electron/electron.d.ts:7000:5 - error TS2687: All declarations of 'hostOnly' must have identical modifiers. 7000 hostOnly?: boolean; ~~~~~~~~ node_modules/electron/electron.d.ts:7004:5 - error TS2687: All declarations of 'httpOnly' must have identical modifiers. 7004 httpOnly?: boolean; ~~~~~~~~ node_modules/electron/electron.d.ts:7012:5 - error TS2687: All declarations of 'path' must have identical modifiers. 7012 path?: string; ~~~~ node_modules/electron/electron.d.ts:7021:5 - error TS2687: All declarations of 'secure' must have identical modifiers. 7021 secure?: boolean; ~~~~~~ node_modules/electron/electron.d.ts:7026:5 - error TS2687: All declarations of 'session' must have identical modifiers. 7026 session?: boolean; ~~~~~~~ node_modules/electron/electron.d.ts:8746:5 - error TS2687: All declarations of 'returnValue' must have identical modifiers. 8746 returnValue: any; ~~~~~~~~~~~ node_modules/electron/electron.d.ts:9105:5 - error TS2687: All declarations of 'type' must have identical modifiers. 9105 type?: ('task' | 'separator' | 'file'); ~~~~ node_modules/electron/electron.d.ts:11246:5 - error TS2687: All declarations of 'pacScript' must have identical modifiers. 11246 pacScript?: string; ~~~~~~~~~ node_modules/electron/electron.d.ts:11250:5 - error TS2687: All declarations of 'proxyBypassRules' must have identical modifiers. 11250 proxyBypassRules?: string; ~~~~~~~~~~~~~~~~ node_modules/electron/electron.d.ts:11254:5 - error TS2687: All declarations of 'proxyRules' must have identical modifiers. 11254 proxyRules?: string; ~~~~~~~~~~ node_modules/electron/electron.d.ts:13514:5 - error TS2687: All declarations of 'description' must have identical modifiers. 13514 description: string; ~~~~~~~~~~~ node_modules/electron/electron.d.ts:13520:5 - error TS2687: All declarations of 'iconIndex' must have identical modifiers. 13520 iconIndex: number; ~~~~~~~~~ node_modules/electron/electron.d.ts:17721:14 - error TS2687: All declarations of 'debugger' must have identical modifiers. 17721 readonly debugger: Debugger; ~~~~~~~~ node_modules/electron/electron.d.ts:17730:14 - error TS2687: All declarations of 'devToolsWebContents' must have identical modifiers. 17730 readonly devToolsWebContents: (WebContents) | (null); ~~~~~~~~~~~~~~~~~~~ node_modules/electron/electron.d.ts:17749:14 - error TS2687: All declarations of 'hostWebContents' must have identical modifiers. 17749 readonly hostWebContents: WebContents; ~~~~~~~~~~~~~~~ node_modules/electron/electron.d.ts:17755:14 - error TS2687: All declarations of 'id' must have identical modifiers. 17755 readonly id: number; ~~ node_modules/electron/electron.d.ts:17807:14 - error TS2687: All declarations of 'session' must have identical modifiers. 17807 readonly session: Session; ~~~~~~~ node_modules/electron/electron.d.ts:20137:5 - error TS2687: All declarations of 'submitURL' must have identical modifiers. 20137 submitURL?: string; ~~~~~~~~~ node_modules/electron/electron.d.ts:20147:5 - error TS2687: All declarations of 'companyName' must have identical modifiers. 20147 companyName?: string; ~~~~~~~~~~~ node_modules/electron/electron.d.ts:20656:5 - error TS2687: All declarations of 'cache' must have identical modifiers. 20656 cache: boolean; ~~~~~ node_modules/electron/electron.d.ts:20956:5 - error TS2687: All declarations of 'wasOpenedAtLogin' must have identical modifiers. 20956 wasOpenedAtLogin: boolean; ~~~~~~~~~~~~~~~~ node_modules/electron/electron.d.ts:20965:5 - error TS2687: All declarations of 'wasOpenedAsHidden' must have identical modifiers. 20965 wasOpenedAsHidden: boolean; ~~~~~~~~~~~~~~~~~ node_modules/electron/electron.d.ts:20975:5 - error TS2687: All declarations of 'restoreState' must have identical modifiers. 20975 restoreState: boolean; ~~~~~~~~~~~~ node_modules/electron/electron.d.ts:23309:5 - error TS2687: All declarations of 'activeMatchOrdinal' must have identical modifiers. 23309 activeMatchOrdinal: number; ~~~~~~~~~~~~~~~~~~ node_modules/electron/electron.d.ts:23313:5 - error TS2687: All declarations of 'matches' must have identical modifiers. 23313 matches: number; ~~~~~~~ node_modules/electron/electron.d.ts:23317:5 - error TS2687: All declarations of 'selectionArea' must have identical modifiers. 23317 selectionArea: Rectangle; ~~~~~~~~~~~~~ node_modules/electron/electron.d.ts:25644:14 - error TS2687: All declarations of 'defaultApp' must have identical modifiers. 25644 readonly defaultApp: boolean; ~~~~~~~~~~ node_modules/electron/electron.d.ts:25662:14 - error TS2687: All declarations of 'mas' must have identical modifiers. 25662 readonly mas: boolean; ~~~ node_modules/electron/electron.d.ts:25667:5 - error TS2687: All declarations of 'noAsar' must have identical modifiers. 25667 noAsar: boolean; ~~~~~~ node_modules/electron/electron.d.ts:25683:14 - error TS2687: All declarations of 'resourcesPath' must have identical modifiers. 25683 readonly resourcesPath: string; ~~~~~~~~~~~~~ node_modules/electron/electron.d.ts:25720:14 - error TS2687: All declarations of 'type' must have identical modifiers. 25720 readonly type: ('browser' | 'renderer' | 'service-worker' | 'worker' | 'utility'); ~~~~ node_modules/electron/electron.d.ts:25726:14 - error TS2687: All declarations of 'windowsStore' must have identical modifiers. 25726 readonly windowsStore: boolean; ~~~~~~~~~~~~ node_modules/electron/electron.d.ts:25729:14 - error TS2687: All declarations of 'electron' must have identical modifiers. 25729 readonly electron: string; ~~~~~~~~ node_modules/electron/electron.d.ts:25730:14 - error TS2687: All declarations of 'chrome' must have identical modifiers. 25730 readonly chrome: string; ~~~~~~ preload.ts:2:1 - error TS6131: Cannot compile modules using option 'outFile' unless the '--module' flag is 'amd' or 'system'. 2 import { contextBridge, ipcRenderer } from 'electron'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Found 100 errors in 3 files. Errors Files 61 node_modules/@types/electron/index.d.ts:8 38 node_modules/electron/electron.d.ts:8 1 preload.ts:2
11-01
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值