declare

typescript declare third party modules

≯℡__Kan透↙ 提交于 2019-11-30 17:39:06
How could I declare a third party module which looks like this: in third party module: module.exports = function foo(){ // do somthing } in my code: import * as foo from 'foo-module'; // Can not find a declaration module for ... foo(); Check out the documentation on working with 3rd party modules . How to write the declaration depends a lot on how the module was written and what it exports. The example you've given is a CommonJS module ( module.exports = ... ) which is not really a valid ES6 module, because ES6 cannot export a function as the module (it can only export function members or a

typescript declare third party modules

痞子三分冷 提交于 2019-11-30 16:40:44
问题 How could I declare a third party module which looks like this: in third party module: module.exports = function foo(){ // do somthing } in my code: import * as foo from 'foo-module'; // Can not find a declaration module for ... foo(); 回答1: Check out the documentation on working with 3rd party modules. How to write the declaration depends a lot on how the module was written and what it exports. The example you've given is a CommonJS module ( module.exports = ... ) which is not really a valid

Why use constants in programming? [closed]

[亡魂溺海] 提交于 2019-11-30 11:51:57
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . I've just been going back over a bit of C studying using Ivor Horton's Beginning C book. I got to the bit about declaring constants

Forward declare a struct in Objective-C

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 11:36:10
I'm creating a protocol, and one of the parameters to a method I'm defining is a CMTime* . I would like to forward declare CMTime as opposed to including it. However, I've tried @class CMTime and it complains that it is redefined elsewhere as a different type of symbol. Documentation says it's a struct. I've tried forward declaring it as struct CMTime; but it still is complaining that it doesn't know what it is. Any ideas what I'm doing wrong? A source compiled as ObjC has the same rules as C in this regard. A source compiled as ObjC++ has the same rules as C++ in this regard. @class MONClass;

Why are “declare -f” and “declare -a” needed in bash scripts?

人走茶凉 提交于 2019-11-30 11:20:39
Sorry for so innocent question - I just try to undertand... For example - I have: $ cat test.sh #!/bin/bash declare -f testfunct testfunct () { echo "I'm function" } testfunct declare -a testarr testarr=([1]=arr1 [2]=arr2 [3]=arr3) echo ${testarr[@]} And when I run it I get: $ ./test.sh I'm function arr1 arr2 arr3 So here is a question - for what i must (if must...) insert declare here? With it - or without it it works the same... I can understand for example declare -i var or declare -r var . But for what is -f (declare function) and -a (declare array)? Thanks for tips and links. declare -f

Declare row type variable in PL/pgSQL

走远了吗. 提交于 2019-11-30 08:40:19
As I found SELECT * FROM t INTO my_data; works only if: DO $$ DECLARE my_data t%ROWTYPE; BEGIN SELECT * FROM t INTO my_data WHERE id = ?; END $$; Am I right? If I want to get only 2-3 columns instead of all columns. How can I define my_data ? That is, DO $$ DECLARE my_data <WHAT HERE??>; BEGIN SELECT id,name,surname FROM t INTO my_data WHERE id = ?; END $$; get only 2-3 columns instead of all columns One way: use a record variable: DO $$ DECLARE _rec record; BEGIN SELECT INTO _rec id, name, surname FROM t WHERE id = ?; END $$; Note that the structure of a record type is undefined until

C90: How do I globally initialize this struct in C without C99 extensions

江枫思渺然 提交于 2019-11-30 07:41:18
I was wondering what the best way to initialize this struct is with C90, while still keeping it neat. In my header file, call it test.h, I have the following struct defined: struct s_test_cfg{ char *a[3]; char *b[3]; char *c[3]; } Then I have it declared as an extern struct so that I can initialize it globally in the .c file: extern struct s_test_cfg test_cfg; Now in my .c file, I want to be able to declare something like this globally (obviously what I'm about to write is unsupported in C90): struct s_test_cfg test_cfg = { .a = {"a", "b", "c"},\ .b = {"d", "e", "f"},\ .c = {"g", "h", "i"} };

Why use constants in programming? [closed]

点点圈 提交于 2019-11-30 04:31:49
I've just been going back over a bit of C studying using Ivor Horton's Beginning C book. I got to the bit about declaring constants which seems to get mixed up with variables in the same sentence. Just to clarify, what is the difference in specifying constants and variables in C, and really, when do you need to use a constant instead of a variable? I know folks say to use a constant when the information doesn't change during program execution but I can't really think of a time when a variable couldn't be used instead. A variable, as you can guess from the name, varies over time. If it doesn't

create triggers - error at DECLARE

这一生的挚爱 提交于 2019-11-29 17:23:27
i learn triggers from http://forge.mysql.com/wiki/Triggers and i have: create trigger bi_emps_fer before insert on emps for each row begin declare newsal numeric default 0; declare namelength, l_loop int default 0; set namelength = length(new.emp_name); while l_loop < namelength do set newsal := newsal new.salary; set l_loop := l_loop 1; end while; set new.salary = newsal; end and error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4 why? i use MySQL 5.5.8 and phpmyadmin 3.3.9 did you

Forward declare a struct in Objective-C

↘锁芯ラ 提交于 2019-11-29 17:15:38
问题 I'm creating a protocol, and one of the parameters to a method I'm defining is a CMTime* . I would like to forward declare CMTime as opposed to including it. However, I've tried @class CMTime and it complains that it is redefined elsewhere as a different type of symbol. Documentation says it's a struct. I've tried forward declaring it as struct CMTime; but it still is complaining that it doesn't know what it is. Any ideas what I'm doing wrong? 回答1: A source compiled as ObjC has the same rules