type-declaration

Generate declaration file with single module in TypeScript

北战南征 提交于 2021-01-27 04:32:25
问题 Given the following folder structure: src/ ├── foo.ts ├── bar.ts ├── baz.ts ├── index.ts Where foo.ts , bar.ts , and baz.ts each export a default class or thing: i.e. in the case of foo.ts : export default class Foo { x = 2; } Can we automatically generate a declaration file which declares one module my-module and exports foo.ts , bar.ts , and baz.ts as non-defaults ? I.e. I want tsc to generate the following: build/ ├── foo.js ├── bar.js ├── baz.js ├── index.js ├── index.d.ts Where index.d

Generate declaration file with single module in TypeScript

隐身守侯 提交于 2021-01-27 04:31:20
问题 Given the following folder structure: src/ ├── foo.ts ├── bar.ts ├── baz.ts ├── index.ts Where foo.ts , bar.ts , and baz.ts each export a default class or thing: i.e. in the case of foo.ts : export default class Foo { x = 2; } Can we automatically generate a declaration file which declares one module my-module and exports foo.ts , bar.ts , and baz.ts as non-defaults ? I.e. I want tsc to generate the following: build/ ├── foo.js ├── bar.js ├── baz.js ├── index.js ├── index.d.ts Where index.d

Generate declaration file with single module in TypeScript

佐手、 提交于 2021-01-27 04:30:40
问题 Given the following folder structure: src/ ├── foo.ts ├── bar.ts ├── baz.ts ├── index.ts Where foo.ts , bar.ts , and baz.ts each export a default class or thing: i.e. in the case of foo.ts : export default class Foo { x = 2; } Can we automatically generate a declaration file which declares one module my-module and exports foo.ts , bar.ts , and baz.ts as non-defaults ? I.e. I want tsc to generate the following: build/ ├── foo.js ├── bar.js ├── baz.js ├── index.js ├── index.d.ts Where index.d

Understanding variable scope in Go

丶灬走出姿态 提交于 2019-12-01 17:52:42
问题 I am going through the Go specification to learn the language, and these points are taken from the spec under "Declarations and scope." Though I am able to understand points 1-4, I am confused on points 5 and 6: The scope of a constant or variable identifier declared inside a function begins at the end of the ConstSpec or VarSpec (ShortVarDecl for short variable declarations) and ends at the end of the innermost containing block. The scope of a type identifier declared inside a function

Understanding variable scope in Go

萝らか妹 提交于 2019-12-01 17:51:02
I am going through the Go specification to learn the language, and these points are taken from the spec under " Declarations and scope ." Though I am able to understand points 1-4, I am confused on points 5 and 6: The scope of a constant or variable identifier declared inside a function begins at the end of the ConstSpec or VarSpec (ShortVarDecl for short variable declarations) and ends at the end of the innermost containing block. The scope of a type identifier declared inside a function begins at the identifier in the TypeSpec and ends at the end of the innermost containing block. This is

What is the meaning of this type declaration?

狂风中的少年 提交于 2019-12-01 10:26:28
问题 I am actually learning golang (from .NET) and there is one thing I don't understand about this language. Sometimes I find this kind of declaration: https://github.com/golang/crypto/blob/master/ed25519/ed25519.go // PublicKey is the type of Ed25519 public keys. type PublicKey []byte What does it mean exactly? Is it a creating a struct which inherit from []byte? Is it just an alias? I thought golang forbid inheritance. 回答1: It's a type declaration, more specifically a type definition . It

Differences between class declarations

。_饼干妹妹 提交于 2019-11-30 14:51:31
问题 There are many ways to declare a new class type: TMyClass1 = TObject; TMyClass2 = type TObject; TMyClass3 = class end; TMyClass4 = class(TObject); TMyClass5 = class(TObject) end; It's my understanding that class 3, 4 and 5 are descendants of TObject , but it's not clear how 1 and 2 differ, and what the differences between 3,4 and 5 are. Are there any differences? 回答1: TMyClass1 is just an alias - a different name for TObject TMyClass2 is a strongly typed alias for TObject (we call them "type

Differences between class declarations

守給你的承諾、 提交于 2019-11-30 11:50:55
There are many ways to declare a new class type: TMyClass1 = TObject; TMyClass2 = type TObject; TMyClass3 = class end; TMyClass4 = class(TObject); TMyClass5 = class(TObject) end; It's my understanding that class 3, 4 and 5 are descendants of TObject , but it's not clear how 1 and 2 differ, and what the differences between 3,4 and 5 are. Are there any differences? TMyClass1 is just an alias - a different name for TObject TMyClass2 is a strongly typed alias for TObject (we call them "type'd types"); it's very unusual to use this with classes, though, normally you'd use this with e.g. Pointer to

How to relate to type from outer context

狂风中的少年 提交于 2019-11-30 04:16:29
Let us consider the following code snippet: blah :: a -> b -> a blah x y = ble x where ble :: b -> b ble x = x This compiles fine under GHC, which essentially means that b from the 3rd line is something different than b from the first line. My question is simple: is there a way to somehow relate in the type declaration of ble to a type used in an outer context, i.e. the type declaration of blah ? Obviously, this is just an example and not a real-world use-case for type declarations. This is possible with the ScopedTypeVariables extension. You need to use explicit forall's to bring the type

What is difference between Command$ and Command in VB 6?

♀尐吖头ヾ 提交于 2019-11-29 14:55:20
问题 What is difference between Command$ and Command in VB 6? MsgBox Command$ MsgBox Command 回答1: Any time you see a $ after a function in VB 6, it means that the function is a String version , meaning it returns a value of type String . The version without the dollar sign is a Variant function, which of course means it returns a value of type Variant . In general, you should always prefer the String versions over the Variant versions. The dollar sign also means the same thing if it appears after