TypeScript Handbook TypeScript 4 7 Typescriptlang Org instant download
TypeScript Handbook TypeScript 4 7 Typescriptlang Org instant download
https://ebookmeta.com/product/typescript-handbook-
typescript-4-7-typescriptlang-org/
https://ebookmeta.com/product/typescript-handbook-
typescript-4-8-typescriptlang-org/
https://ebookmeta.com/product/typescript-handbook-
typescript-4-8-typescriptlang-org-2/
https://ebookmeta.com/product/essential-typescript-4-2nd-edition-
adam-freeman/
https://ebookmeta.com/product/education-policy-research-
epistemological-and-theoretical-issues-1st-edition-mainardes/
Reconceptualizing Schizophrenia The Phenomenology of
Urhomelessness 1st Edition Edited By Sarah R Kamens
https://ebookmeta.com/product/reconceptualizing-schizophrenia-
the-phenomenology-of-urhomelessness-1st-edition-edited-by-sarah-
r-kamens/
https://ebookmeta.com/product/the-cambridge-companion-to-
rabindranath-tagore-cambridge-companions-to-literature-sukanta-
chaudhuri-editor/
https://ebookmeta.com/product/an-introductory-course-to-
philosophy-of-language-ufuk-azen-baykent/
https://ebookmeta.com/product/the-healing-energy-of-your-hands-
michael-bradford/
https://ebookmeta.com/product/the-dynamics-of-right-wing-
extremism-within-german-society-1st-edition-oliver-decker/
A Clinician's Guide to Statistics in Mental Health S.
Nassir Ghaemi
https://ebookmeta.com/product/a-clinicians-guide-to-statistics-
in-mental-health-s-nassir-ghaemi/
This copy of the TypeScript handbook was
created on Friday, June 24, 2022 against commit
e538f6 with TypeScript 4.7.
Table of Contents
The most common kinds of errors that programmers write can be described as type errors: a
certain kind of value was used where a different kind of value was expected. This could be due to
simple typos, a failure to understand the API surface of a library, incorrect assumptions about
runtime behavior, or other errors. The goal of TypeScript is to be a static typechecker for JavaScript
programs - in other words, a tool that runs before your code runs (static) and ensures that the types
of the program are correct (typechecked).
If you are coming to TypeScript without a JavaScript background, with the intention of TypeScript
being your first language, we recommend you first start reading the documentation on either the
Microsoft Learn JavaScript tutorial or read JavaScript at the Mozilla Web Docs. If you have
experience in other languages, you should be able to pick up JavaScript syntax quite quickly by
reading the handbook.
The Handbook
You should expect each chapter or page to provide you with a strong understanding of the given
concepts. The TypeScript Handbook is not a complete language specification, but it is intended to
be a comprehensive guide to all of the language's features and behaviors.
A reader who completes the walkthrough should be able to:
In the interests of clarity and brevity, the main content of the Handbook will not explore every
edge case or minutiae of the features being covered. You can find more details on particular
concepts in the reference articles.
Reference Files
The reference section below the handbook in the navigation is built to provide a richer
understanding of how a particular part of TypeScript works. You can read it top-to-bottom, but
each section aims to provide a deeper explanation of a single concept - meaning there is no aim
for continuity.
Non-Goals
The Handbook is also intended to be a concise document that can be comfortably read in a few
hours. Certain topics won't be covered in order to keep things short.
Specifically, the Handbook does not fully introduce core JavaScript basics like functions, classes, and
closures. Where appropriate, we'll include links to background reading that you can use to read up
on those concepts.
The Handbook also isn't intended to be a replacement for a language specification. In some cases,
edge cases or formal descriptions of behavior will be skipped in favor of high-level, easier-to-
understand explanations. Instead, there are separate reference pages that more precisely and
formally describe many aspects of TypeScript's behavior. The reference pages are not intended for
readers unfamiliar with TypeScript, so they may use advanced terminology or reference topics you
haven't read about yet.
Finally, the Handbook won't cover how TypeScript interacts with other tools, except where
necessary. Topics like how to configure TypeScript with webpack, rollup, parcel, react, babel, closure,
lerna, rush, bazel, preact, vue, angular, svelte, jquery, yarn, or npm are out of scope - you can find
these resources elsewhere on the web.
Get Started
Before getting started with The Basics, we recommend reading one of the following introductory
pages. These introductions are intended to highlight key similarities and differences between
TypeScript and your favored programming language, and clear up common misconceptions
specific to those languages.
// Calling 'message'
message();
If we break this down, the first runnable line of code accesses a property called toLowerCase and
then calls it. The second one tries to call message directly.
But assuming we don't know the value of message - and that's pretty common - we can't reliably
say what results we'll get from trying to run any of this code. The behavior of each operation
depends entirely on what value we had in the first place.
Is message callable?
The answers to these questions are usually things we keep in our heads when we write JavaScript,
and we have to hope we got all the details right.
As you can probably guess, if we try to run message.toLowerCase() , we'll get the same string
only in lower-case.
What about that second line of code? If you're familiar with JavaScript, you'll know this fails with an
exception:
When we run our code, the way that our JavaScript runtime chooses what to do is by figuring out
the type of the value - what sorts of behaviors and capabilities it has. That's part of what that
TypeError is alluding to - it's saying that the string "Hello World!" cannot be called as a
function.
For some values, such as the primitives string and number , we can identify their type at runtime
using the typeof operator. But for other things like functions, there's no corresponding runtime
mechanism to identify their types. For example, consider this function:
function fn(x) {
return x.flip();
}
We can observe by reading the code that this function will only work if given an object with a
callable flip property, but JavaScript doesn't surface this information in a way that we can check
while the code is running. The only way in pure JavaScript to tell what fn does with a particular
value is to call it and see what happens. This kind of behavior makes it hard to predict what code
will do before it runs, which means it's harder to know what your code is going to do while you're
writing it.
Seen in this way, a type is the concept of describing which values can be passed to fn and which
will crash. JavaScript only truly provides dynamic typing - running the code to see what happens.
The alternative is to use a static type system to make predictions about what code is expected
before it runs.
Static type-checking
Think back to that TypeError we got earlier from trying to call a string as a function. Most
people don't like to get any sorts of errors when running their code - those are considered bugs!
And when we write new code, we try our best to avoid introducing new bugs.
If we add just a bit of code, save our file, re-run the code, and immediately see the error, we might
be able to isolate the problem quickly; but that's not always the case. We might not have tested the
feature thoroughly enough, so we might never actually run into a potential error that would be
thrown! Or if we were lucky enough to witness the error, we might have ended up doing large
refactorings and adding a lot of different code that we're forced to dig through.
Ideally, we could have a tool that helps us find these bugs before our code runs. That's what a static
type-checker like TypeScript does. Static types systems describe the shapes and behaviors of what
our values will be when we run our programs. A type-checker like TypeScript uses that information
and tells us when things might be going off the rails.
message();
This
This expression
expression is
is not
not callable.
callable.
Type
Type 'String'
'String' has
has no
no call
call signatures.
signatures.
Running that last sample with TypeScript will give us an error message before we run the code in
the first place.
Non-exception Failures
So far we've been discussing certain things like runtime errors - cases where the JavaScript runtime
tells us that it thinks something is nonsensical. Those cases come up because the ECMAScript
specification has explicit instructions on how the language should behave when it runs into
something unexpected.
For example, the specification says that trying to call something that isn't callable should throw an
error. Maybe that sounds like "obvious behavior", but you could imagine that accessing a property
that doesn't exist on an object should throw an error too. Instead, JavaScript gives us different
behavior and returns the value undefined :
const user = {
name: "Daniel",
age: 26,
};
const user = {
name: "Daniel",
age: 26,
};
user.location;
Property
Property 'location'
'location' does
does not
not exist
exist on
on type
type '{
'{ name:
name: string;
string; age:
age: number;
number;
}'. }'.
While sometimes that implies a trade-off in what you can express, the intent is to catch legitimate
bugs in our programs. And TypeScript catches a lot of legitimate bugs.
uncalled functions,
function flipCoin() {
// Meant to be Math.random()
return Math.random < 0.5;
Operator
Operator '<'
'<' cannot
cannot be
be applied
applied to
to types
types '()
'() =>
=> number'
number' and
and 'number'.
'number'.
This
This condition
condition will
will always
always return
return 'false'
'false' since
since the
the types
types '"a"'
'"a"' and
and '"b"'
'"b"'
have nohave
overlap.
no overlap.
// Oops, unreachable
}
The type-checker has information to check things like whether we're accessing the right properties
on variables and other properties. Once it has that information, it can also start suggesting which
properties you might want to use.
That means TypeScript can be leveraged for editing code too, and the core type-checker can
provide error messages and code completion as you type in the editor. That's part of what people
often refer to when they talk about tooling in TypeScript.
sendfile
app.listen(3000);
sendFile
TypeScript takes tooling seriously, and that goes beyond completions and errors as you type. An
editor that supports TypeScript can deliver "quick fixes" to automatically fix errors, refactorings to
easily re-organize code, and useful navigation features for jumping to definitions of a variable, or
finding all references to a given variable. All of this is built on top of the type-checker and is fully
cross-platform, so it's likely that your favorite editor has TypeScript support available.
tsc , the TypeScript compiler
We've been talking about type-checking, but we haven't yet used our type-checker. Let's get
acquainted with our new friend tsc , the TypeScript compiler. First we'll need to grab it via npm.
This installs the TypeScript Compiler tsc globally. You can use npx or similar tools if you'd prefer to
run tsc from a local node_modules package instead.
Now let's move to an empty folder and try writing our first TypeScript program: hello.ts :
Notice there are no frills here; this "hello world" program looks identical to what you'd write for a
"hello world" program in JavaScript. And now let's type-check it by running the command tsc
which was installed for us by the typescript package.
tsc hello.ts
Tada!
Wait, "tada" what exactly? We ran tsc and nothing happened! Well, there were no type errors, so
we didn't get any output in our console since there was nothing to report.
But check again - we got some file output instead. If we look in our current directory, we'll see a
hello.js file next to hello.ts . That's the output from our hello.ts file after tsc compiles
or transforms it into a plain JavaScript file. And if we check the contents, we'll see what TypeScript
spits out after it processes a .ts file:
greet("Brendan");
If we run tsc hello.ts again, notice that we get an error on the command line!
TypeScript is telling us we forgot to pass an argument to the greet function, and rightfully so. So
far we've only written standard JavaScript, and yet type-checking was still able to find problems
with our code. Thanks TypeScript!
To reiterate from earlier, type-checking code limits the sorts of programs you can run, and so there's
a tradeoff on what sorts of things a type-checker finds acceptable. Most of the time that's okay, but
there are scenarios where those checks get in the way. For example, imagine yourself migrating
JavaScript code over to TypeScript and introducing type-checking errors. Eventually you'll get
around to cleaning things up for the type-checker, but that original JavaScript code was already
working! Why should converting it over to TypeScript stop you from running it?
So TypeScript doesn't get in your way. Of course, over time, you may want to be a bit more
defensive against mistakes, and make TypeScript act a bit more strictly. In that case, you can use the
noEmitOnError compiler option. Try changing your hello.ts file and running tsc with that
flag:
Explicit Types
Up until now, we haven't told TypeScript what person or date are. Let's edit the code to tell
TypeScript that person is a string , and that date should be a Date object. We'll also use the
toDateString() method on date .
What we did was add type annotations on person and date to describe what types of values
greet can be called with. You can read that signature as " greet takes a person of type
string , and a date of type Date ".
With this, TypeScript can tell us about other cases where greet might have been called incorrectly.
For example...
greet("Maddison", Date());
Argument
Argument of
of type
type 'string'
'string' is
is not
not assignable
assignable to
to parameter
parameter of
of type
type 'Date'.
'Date'.
Keep in mind, we don't always have to write explicit type annotations. In many cases, TypeScript can
even just infer (or "figure out") the types for us even if we omit them.
Even though we didn't tell TypeScript that msg had the type string it was able to figure that out.
That's a feature, and it's best not to add annotations when the type system would end up inferring
the same type anyway.
Note: The message bubble inside the previous code sample is what your editor would show if you had
hovered over the word.
Erased Types
Let's take a look at what happens when we compile the above function greet with tsc to output
JavaScript:
"use strict";
function greet(person, date) {
console.log("Hello ".concat(person, ", today is ").concat(date.toDateS
}
greet("Maddison", new Date());
Notice two things here:
More on that second point later, but let's now focus on that first point. Type annotations aren't part
of JavaScript (or ECMAScript to be pedantic), so there really aren't any browsers or other runtimes
that can just run TypeScript unmodified. That's why TypeScript needs a compiler in the first place -
it needs some way to strip out or transform any TypeScript-specific code so that you can run it.
Most TypeScript-specific code gets erased away, and likewise, here our type annotations were
completely erased.
Remember: Type annotations never change the runtime behavior of your program.
Downleveling
One other difference from the above was that our template string was rewritten from
to
Template strings are a feature from a version of ECMAScript called ECMAScript 2015 (a.k.a.
ECMAScript 6, ES2015, ES6, etc. - don't ask). TypeScript has the ability to rewrite code from newer
versions of ECMAScript to older ones such as ECMAScript 3 or ECMAScript 5 (a.k.a. ES3 and ES5).
This process of moving from a newer or "higher" version of ECMAScript down to an older or
"lower" one is sometimes called downleveling.
By default TypeScript targets ES3, an extremely old version of ECMAScript. We could have chosen
something a little bit more recent by using the target option. Running with --target es2015
changes TypeScript to target ECMAScript 2015, meaning code should be able to run wherever
ECMAScript 2015 is supported. So running tsc --target es2015 hello.ts gives us the
following output:
Another Random Scribd Document
with Unrelated Content
average 16 feet, and it might happen that as much as 35,000,000
tons of that amount would have to be raised in one month.
The North Sea Canal was constructed for the purpose of
facilitating the navigation of the Zuyder Zee, which, by reason of its
numerous shallows, was very intricate and difficult, and in order that
vessels might avoid the Pampus—a bank that rises where the Y joins
the Zuyder Zee, and formerly compelled large vessels to load and
unload a part of their cargoes in the roads. These obstacles
frequently detained vessels for as much as three weeks.[89]
M’Cullough spoke of this canal as “the greatest work of its kind in
Holland, and probably in the world.”[90] It was begun in 1819, and
completed in 1825. The length of the canal is about 50½ miles; the
breadth at the surface, 124½ English feet, and at the bottom 30
feet, while the depth is 20 feet 9 inches. It is a tide-level canal, and
is provided with two tide-locks at each end. Intermediately, there are
two sluices, with flood-gates. The locks and sluices are double. The
canal is crossed by about eighteen drawbridges. The cost of the
undertaking was about million sterling.
At the further end of the canal, at Niewdiep, a harbour was
constructed, which has been very much frequented by the shipping
of Amsterdam. About eighteen hours were formerly occupied in
towing ships from Niewdiep to Amsterdam.
The Amsterdam Ship Canal.—The Amsterdam Ship Canal,
designed by Mr. Hawkshaw, and Heer J. Dirks, of Holland, is a
gigantic example of engineering compressed within a limited extent.
The burgesses of Amsterdam had spent millions in improving the
access to that great commercial port—first, on long previous
operations in the Zuyder Zee, and, subsequently, on the North
Holland Ship Canal, which stretches nearly due north from their city
to the Helder, between which point and the Texel Island opposite is
the entrance from the North Sea, which was then the only available
channel for large vessels.
The exigiencies of their trade calling imperatively for further
improvements, the engineers furnished them with the design for a
new ship canal, which reduces the navigable distance to 15½ miles,
on a course about west from Amsterdam to the North Sea, available
for larger vessels than formerly entered the port—and has provided
a new harbour on the coast, with an area of 250 acres, bounded by
breakwaters formed of concrete blocks set in regular courses, with
853 feet of entrance between the pier heads, and 26¼ feet
minimum depth of water. The width of the sea canal is 197 feet at
the surface, and 88 feet at the bottom; minimum depth, 23 feet; the
locks are 59 feet wide, and of proportionate length.
There are three locks or entrances at the north end of the canal
from the new harbour. Eastward, and below the city and wharves of
Amsterdam, there is an enormous dyke to shut out the Zuyder Zee,
pierced with three locks, besides sluices. These are built upon such a
lake of mud as to require nearly 10,000 piles in their foundation.
Thus the canal is approached by locks at each end, not for the
purpose of locking up, but for locking down, as the surface water of
the canal has to be kept twenty inches under low-water mark. To
accomplish this, in addition to the locks and sluices, that can only
avail at low tides, pumping power was required at the dyke, which
bars out the Zuyder Zee. The three large centrifugal pumps by
Messrs. Eastons, Amos, and Anderson, were constructed to lift
together 440,000 gallons of water per minute. The works on this
canal took nearly ten years to complete. They included the
construction of branch canals to the several towns and ports on the
borders of the lakes, which, although of smaller sectional area,
exceeded the sea canal in their total extent. Mr. Vignoles, in his
Presidential Address to the Institution of Civil Engineers,[91] from
which most of the above particulars are taken, has stated that the
Amsterdam Ship Canal resembled the Suez Canal, in passing through
large muddy lakes, similar to Lake Menzaleh. (See Suez Canal).
The ship canals communicating with Rotterdam are described by
a recent writer[92] on the subject as follows:—
1. The Voorne Canal running from Helvoetsluis through
the island of Voorne to the river Maas. The resolution of
March 9th, 1880, resettled the police regulations for this
route; the maximum dimensions of vessels using it being
—length, 110; beam, 13·70; draught, 6 metres.
2. The Niewe-waterweg, or direct entrance from the
North Sea to the Maas, which is without sluices, and is cut
through the Hoek van Holland, thus forming a new outlet
to the Maas.
Besides these approaches, there is another route to Rotterdam,
to which great attention has been paid of late years, but the railway
bridge across the river at Rotterdam causes a certain inconvenience
to vessels using it. Vessels coming from the sea by the
Hollandschdiep, enter the narrow passage of the Kil near the great
Moerdyke railway bridge, and passing Dordrecht, the Maas is
reached above the Rotterdam railway bridge. The Nieuwe-Haven,
just above this bridge, is a most convenient port for small steam-
yachts visiting Rotterdam.
There are two other important ship canals, giving access from
the river Schelde to the inland waters of Holland:—
1. The Walcheren Canal, about seven miles long, from
the new port of Flushing to Veere, which place, formerly
known as Campvere, was a free port of the Scotch, who
had a factory or trade station there for 300 years, from
the year 1506. The maximum dimensions for vessels using
this canal are:—Length, 120; breadth, 19·75; and draught,
7·10 metres.
2. The South Beveland Canal, from the West Schelde
at Hansweert to the East Schelde at Wemeldinge, is five
miles in length. The regulations of this canal, fixed by the
resolution of May 28th, 1880, allow vessels of the
following dimensions to use it, viz. length, 100; breadth,
15·75; draught, 7·10 metres.
The former of these two canals is not much used, but there is a
great traffic of the large Rhine arks, and the inland steam barges
and sailing vessels of Holland, going to and from Antwerp, Brussels,
Ghent, and other towns of Belgium. The locks, like the others in the
more important canals, take in thirty to forty of these vessels at
once, all masters having to show their papers before passing. These
ship canals are all State property, and are under the management of
the Minister of the Waterstaat, Trade, and Industry. Many of the
smaller inland navigations are under State control, but others belong
to the communes through which they pass. The water-level, which is
so all-important in the Netherlands, is regulated by the Amsterdam
mark, called the A.P. (Amsterdamsche Peil).
The following navigations, with some others, are also regulated
by police rules, fixed by resolutions of the State:—
1. The Afwaterings Kanaal, from the Noordervaart and
the Neeritter, near Venlo, for vessels—length, 24; breadth,
3·70; draught, 1 metre. The use of steam is forbidden.
2. The canalised river Ijssel, from the river Lek,
opposite to Ijsselmonde, to Gouda, whence there is canal
communication with the river Amstel, to Amsterdam, and
also by the old Rhine, viâ Leiden and Haarlem, to
Spaandam, to the North Sea Canal. There is a great traffic
in the former of these two routes, there being always a
great collection of craft at the sluices at Gouda, waiting
their turns to pass. Large and improved locks are said to
be urgently required at this place. The depth of water on
this route is at least six feet.
3. The Keulsche Vaart, from Vreeswijk, on the river
Lek, viâ Utrecht, the Vecht, and Weesp, to the river
Amstel and Amsterdam. Vessels of a breadth of 7·50
metres, and draught of 2·10 metres, can use the route.
The sluices take in the very long Rhine craft. The pace
allowed for steamers is 130 metres a minute for those of
1·50 draught, to 180 a minute for those of 1 metre
draught.
4. The Meppelerdiep, Zwaartsluis to Meppel, for
vessels of length, 60; breadth, 7·80; draught, 1·80
metres.
5. The Drentsche, Hoofdvaart, and Kolonievaart, from
Meppel to Assen, for vessels drawing 1·60 metres,
between Paradijssluis and Veenebrug; in other parts
vessels of only 1·25 metres are allowed.
6. The Willemsvaart, from the town canal at Zwolle to
the river Ijssel, by the Katerveer, for vessels of the
following dimensions—length 100, breadth 11·80, and
draught 3 metres.
7. The Apeldoorn Canal, from the Ijssel at the sluis
near Dieren to the same river at Hattem, for vessels of the
following dimensions—length 30, breadth 5·90, and
draught 1·56 metres.
8. The Noordervaart, between the Zuid Willemsvaart at
sluis No. 15 and the provincial canal at Beringen, in the
commune Helden, for vessels having a length of 51, a
breadth of 6, and a draught of 1·50 to 1·65 metres.
9. The Dokkum Canal, from Dokkum (in Friesland) to
Stroobos, and the Casper Roblesdiep or Kolonelsdiep,
being the inland route from Friesland to Gröningen.
A deep-water canal communicates between Gröningen and
Delfzijl, in the estuary of the river Ems, whereby the inland
navigation of Germany may be entered, and, finally, the Baltic.
The Elbing Highland Canals.—This system of canals, constructed
between the years 1844 and 1860, connects the group of lakes
around Mohrungen and Preussische Holland, at a height of about
328 feet above the Baltic, with the Drausen Lake, whence flows the
river Elbing, emptying itself into the Frische Haff, on the Gulf of
Dantzic. The whole length of the canal navigation and branches is
123½ miles, of which 28 miles is artificial, and the remainder lake
and stream.
The Puniau lakes are situated at a distance of 10 miles from, and
its waters were originally at a level of 343 feet 9 inches (104·8
metres) above, the Drausen lakes. When the canal was first
constructed, the water-level of the Puniau lake was lowered to the
extent of 17 feet 5 inches, thereby reducing the difference in level
between the two lakes to 326 feet 4 inches. Commencing from the
Drausen Lake, the canal continues level for a length of 1¼ miles,
and in the next 2·17 miles, rises a height of 45 feet 3 inches. This
difference of level was surmounted in the first instance, by five
locks, which have recently been abolished and replaced by an
inclined plane. In the following 4·66 miles the remaining height of
281 feet is attained by four inclined planes.
The cost of original construction was 212,325l. (4,246,500
marks), and, assuming it to have been spent entirely upon the
artificial portion of the canal navigation, which is 28 miles in length,
would amount to 7,583l. per mile (94,376 marks per kilometre). Of
this outlay 70,000l. was expended on the four inclined planes,
exclusive of the earthwork, which latter cost 27,000l., or an average
of 24,250l. for each incline. The total height surmounted by these
five locks and the four inclined planes being 326⅓ feet, the cost of
each foot of rise for the whole length of the canal amounts to
212,325l.
───── = 650l. 12s.
326·33l.
FOOTNOTES
CHAPTER XII
[94] Ann., lib. xii. cap. 56.
[95] Æn., t.v. 563.
[96] “Before the introduction of locks, contrivances called conches
were in use to moderate the too great declivity of the rivers, and
which were opened to allow vessels to pass through. These
openings were 16 or 18 feet in width; a balance lever, loaded at
the end, was made to turn on a pivot, and with it three hanging
posts, united by an iron bar, which crossed them immediately
above the sill; besides these three perpendicular hanging posts
were two others, let some inches into the side walls. These five
posts were all on the same face, and the spaces between them
were all equal. When the balance beam turned upon its pivot, the
three middle posts alone opened, and allowed the boats to pass,
after which the balance beam was turned back to its former
position. At a little distance was placed another balance beam,
having attached to it a wide plank, to allow the lock keeper to
pass over, as well as to place in the grooves of the hanging posts
the small planks which served to exclude the water, by closing up
the intervals; these were on the side opposed to the current, and
in number sufficient to keep the water at the required level. Such
gates, or contrivances for damming up the waters of a river, were
in use at a very early time in Italy, and two such were constructed
at Governolo, in the twelfth century, to pen up the waters of the
Mincio on the side of Mantua.”—Cresy’s ‘Cyclopædia of
Engineering.’
CHAPTER XII.
THE WATERWAYS OF SWEDEN.
Distance. Lockage.
Canal. Lake. Fall. Rise.
miles yards miles yards ft. in.
Canal from Lake
Wenern
to the Wiken 22 1039 .. .. .. 158 0
west
end
Lake Wiken .. .. 12 318 ..
of
summit
Canal at Edet .. 534
Lake .. .. .. 535
Canal .. 581 .. ..
East end
Lake .. .. .. 117 of
summit.
Canal near Forsvik .. 496 ft. in.
Distance. Lockage.
Canal. Lake. Fall. Rise.
Lake Boltensjön .. .. 4 803 9 9
Canal at Rödesund .. 486
Lake Wettern .. .. 19 1136
Canal between
Wettern 2 841 .. .. 49 9
and Lake Boren
Lake Boren .. .. 6 1140
Canal from thence to
14 63 .. .. 130 9
Roxen
Lake Roxen .. .. 15 1423
Canal from thence to
4 446 .. .. 19 6
Asplangen
Lake Asplangen. .. .. 3 208
Canal from thence to
the
10 494 .. .. 86 6
Baltic near
Soderkoping
Total length of canal 54 1460 .. .. 296 3
Total length of lake
.. .. 62 400 296 3
navigation
454 3
Total length of canal
miles yards
and
lakes in English
117 100
miles
About a mile below the cataracts, the course of the Gotha was
again interrupted by a fall called Akerstræum; and at the end of last
century a canal 182 feet long, and 36 feet broad, was constructed
here, through a bed of rock, until, at the other end of the cataract,
the river is clear to Gothenburg. Before the construction of the
Gotha Canal, the traffic for Gothenburg was unloaded at the
cataracts, carried over the wooden road to the end of the falls by
horses, and again put on board vessels which carried it through the
Akerstræum Canal to its ultimate destination.[98]
At Trolhätta, about 1¼ mile below the point where the river
Göta-Elf leaves the Wenner Lake, there occurs a series of falls and
rapids, the river descending 108 feet in a length of about 4590 feet.
The works which were commenced at this place early in the last
century, were well advanced in 1755, when an unusually heavy flood
caused much destruction and loss of life, and the abandonment of
the works, never since resumed. The intention was to surmount the
difference of level, viz., 108 feet, at the falls above mentioned, by
three locks only, with a rise of 36 feet each. In the canal, as
constructed in 1800, there is a chain of eight locks (still in service),
but these being insufficient for the traffic, a second set of eleven
were constructed alongside the former in 1844. These are cut in the
solid granite. There are sixteen locks in all, with a fall of 142 feet on
this canal (Trolhätta), which is 22 miles long. The breadth of the
canal-bottom is 39 feet in soil and 23 feet 5 inches in rock, with a
depth at mean water-level of 12 feet 8 inches. The number of
vessels passing annually is about 7000.
The West Göta Canal, connecting the Wenner and Wetter lakes,
rises from the former by a series of nineteen locks, or a height of
154 feet 6 inches, to the summit level, which is 300 feet above the
sea, and the descent from here to the Baltic, viâ the East Göta canal,
is by thirty-nine locks. The breadth of the bottom of these canals is
46 feet 9 inches with a mean depth of 9 feet 9 inches. These two
canals were completed in 1832 at a cost of 887,500l. The length of
navigation is 116⅔ miles, of which 54⅓ miles are artificial canal,
and 62⅓ miles lake channel. The traffic is from 4000 to 5000 vessels
per annum.
The Dalsland Canal.—The eastern spurs of the high range
dividing Norway from Sweden run in the south through the small
province of Dalsland towards Lake Wenern, and from numerous
valleys, which descend more or less abruptly to the shore, and serve
as channels for many torrents from the mountain ridges. There are
often considerable falls, which supply a vast motive power to works
of various kinds, chiefly bar-iron forges and saw-mills. There was
one serious drawback to this industry. Lake Wenem afforded the only
means of communication between Dalsland and the outer world;
and to reach that lake from the various works, a long and costly land
transport was the sole resource. This became more and more an
obstacle as increased facilities were developed in other parts of the
world. Hence, some forty years ago, the question of utilising the
Dalsland water-courses as a means of transport was broached, and
this was accomplished in the year 1868. Along the Norwegian
frontier, northward, in the province of Wermland, there is a lake, the
Stora Lee, 20 miles long, with an extreme width of 3 miles, which
joins Lake Wenem by a water-course, having eleven continually
descending basins, together constituting a fall of 200 feet. At the
northern extremity of the Stora Lee are the Toksfor works. At a
distance of 12 miles southward, where there is a fall of 28 feet, are
the iron works of Lennartsfors. At this point the Stora Lee is joined
by Lake Leelângen; and lower down, at the junction with Las Lake,
motive power is supplied by a fall to the Billingsfors works. Farther
on, towards Lake Wenem, there are the Gustafsfors Ironworks and
the Skapfors Sawmills, where several falls occur, the highest being a
fall of about 30 feet at Upperud Ironworks.
The Dalsland Canal Company having been formed, with the
governor of the province, Count Sparre, as president, the directors in
1864 succeeded in engaging the assistance of the late Baron Nils
Ericson, Colonel of Engineers. His plan to some extent varied from
former projects, and comprised the following main conditions:—The
construction of a canal at Hofverud, near Upperud, instead of a
railway, so as to avoid unloading and reloading; a route from Las
Lake, past the Billingsfors works to Leelângen; the adoption of the
same dimensions for the whole length of the canal from Upperud to
Stora Lee, viz., a depth of 5½ feet, a width of 13 feet at the bottom,
and a length of 100 feet between the lock gates; and an increase in
the number of locks between Lake Wenem and Stora Lee to twenty-
five instead of fifteen, as proposed. The contract for constructing the
canal according to this plan, including excavations round the fall at
Hofverud and an aqueduct over the stream at that place, was taken
at about 76,000l. sterling, raised chiefly by shares and, to some
extent, by state subventions. It was stipulated that the dimensions
of the canal should be such that vessels of 75 feet in length, 13 feet
beam, and drawing 5 feet of water should be able to navigate it.
Consequently the locks were mainly of the following dimensions:—
Ft. In.
Minimum length between the gates 100 0
” width in the flood gate 14 0
” depth of water on the sill 5 2
” height of the gate wall over the sill 6 7
” width of the sill 6 0
” length of the gate wall 7 0
Radius of the sill and of the left wall 16 0
Length of gate recess 17 0
Radius 50 0
Slope of the lock chamber sides 5 to 1.
Versed sine of the exterior of the inner wall 2 0
” ” outer ” 3 0
The gate-walls and recesses were all constructed with Wargo
cement. The sides of the lock-chambers are of masonry in cement,
supported by an earthen embankment. The gates are single, and
have wooden bolts; the sills are formed of wooden beams 10 inches
by 12 inches. Timber drawbridges are employed throughout, placed
in front of a lock immediately before the recess or entrance.
The canal is of the following dimensions:—
Ft. In.
Minimum width at bottom 13 0
” depth 5 6
Height of the bank above water level 2 0
Width of the bank at top 8 0
” towing path 5 0
At the Waterfalls of Hofverud, the most interesting point of this
canal, the rock on one side is almost perpendicular for 150 feet,
while the other side of the stream is occupied by the ironworks of
Hofverud. For this reason Ericson constructed an iron aqueduct over
the fall of 110 feet span. This aqueduct has the form of an open
box. The two sides for carrying the weight are wrought-iron bow
girders, 10 feet deep at the middle and 6½ feet at the ends, of
English iron plate ¼ inch. The bottom and top flanges are ½ inch
and ⅛ inch thick respectively, formed of three layers of plates bolted
together. The top flange serves as a pathway as well.
The Dalsland canal rises 192 feet 6 inches by twenty-five locks,
the summit level being 338 feet above the sea. The length of the
navigation is 155 miles; but the actual length of the works that were
needed to complete the system is only 4·8 miles.
The locks on this canal are each about 98 feet 6 inches long, with
a breadth of 13 feet 8 inches, and a depth over the sill of 5 feet 4
inches. The breadth of the bottom is 14 feet 6 inches and 15 feet 7
inches, in soil and rock, respectively. The canal is navigated by
vessels of 70 tons, and steamers of 45 tons and 25 h.p. The traffic
amounts to about 4000 vessels per annum. It was completed in
1868 at a cost of 81,500l.
The Kinda Canal rises 171 feet by fifteen locks to a level of 277
feet above the sea. The length of the navigation is 49½ miles, of
which 22¾ is either artificial canal or trained river. The length of the
locks is 90 feet 6 inches, breadth 18 feet 4 inches, and depth over
sill 4 feet 10½ inches. The traffic is from 3000 to 4000 vessels per
annum. It was completed in 1871 at a cost of 72,500l.
The Orebro Canal.—One of the most recent canal undertakings in
Sweden is the Orebro Canal, which is designed to bring down to the
town of that name the traffic from the Mälar and Hjelmar Lakes,
instead of being compelled to cart it from the old harbour of
Skebäck, two or three miles distant. There is no special engineering
feature about the canal, which was commenced in June 1886, and
opened in 1888. For some distance it follows the bed of the Svarta,
and is subsequently divided into two branches, one of which, the
main branch, to the south, has a length of 4600 feet, and the other,
to the north, is 2600 feet long. The former is designed for passenger
and lighter traffic, and the other is specially arranged for the
transport of grain, coal, timber, &c. The main canal has a width of 80
to 90 feet at the water line, and has 8½ feet depth. The lock at the
commencement of the canal is 125 feet long and 25 feet broad, and
at the northern end of the canal, where there is a high granite quay,
1200 feet long, the canal is 150 feet wide. The water on the canal is
enclosed by a dam of 200 feet long, and the total cost of the
undertaking is about 40,000l. The enterprise is mainly interesting as
an example of the local application of water power with a view to
economy of local transport.
Projected Canals.—At the present time a canal is projected
whereby it is intended to connect the Kattegat with the Lake of
Wenern, thus bringing into direct water communication the towns of
Uddevalla and Genersborg. The length of this canal will be about
twelve miles, some four miles of that distance being through lakes.
The level of the canal will be raised above that of Lake Wenern by
three sluices. The depth of water in the Uddevalla harbour and in
the Venersborgvik would limit the depth of the canal to about 21
feet, but this would be sufficient to admit vessels of about 3000
tons. The sluices proposed would be 350 feet long and about 45 feet
in width. The canal would be a natural outlet for a large traffic in
timber, iron, and wood pulp, now so largely employed in the
manufacture of paper.
FOOTNOTES
CHAPTER XII
[97] Thomas Telford, born in Dumfries-shire, Scotland, in humble
circumstances, was, next after Brindley, the greatest English canal
engineer. He constructed the Caledonian, Ellesmere, Gloucester
and Berkeley, Grand Trunk, Birmingham, Macclesfield,
Birmingham and Liverpool Junction, and other canals. He also
constructed a number of harbours, docks, roads, and bridges,
including the Menai Bridge and St. Katherine’s Docks. He died in
1834, and was buried in Westminster Abbey.
[98] Cox’s ‘Travels,’ vol. iv.
CHAPTER XIII.
THE WATERWAYS OF RUSSIA.
“The servitude of rivers is the noblest and most
important victory which man has obtained over the
licentiousness of Nature.”—Gibbon.
The Russian Empire is, in many respects, the most remarkable in
the world. With an area of more than eight and a half million of
square miles, and a population of 110 millions, it is larger than the
whole of the British Empire, including India, Canada, and Australia,
and is about seventy times the size of the British Islands alone. It is
natural that the internal transport of such a vast territory should
present problems of deep interest, and should tax the resources of
the engineers that have been from time to time occupied with their
determination. This has been more than ordinarily difficult because
of the vast distances to be traversed, and the inclement character of
the climate, which practically seals up navigation entirely over a
great part of the Empire for about six months of the year. Happily,
the Empire is provided with a very ample river system, having,
indeed, longer and deeper rivers than any other country in Europe,
which means, of course, that water transport is available over long
distances, without making any special or costly provision for that
purpose.
The enormous distances over which merchandise has been
carried in pre-railway times, throughout the Russian Empire is justly
regarded as one of the most remarkable chapters in the history of
transportation. For many years previous to the commencement of
the present century, large quantities of iron, salt, gold and silver, furs
and skins, tallow, leather, marble and precious stones, in addition to
the special products of China, were carried from the latter country to
St. Petersburg, a distance of fully 2000 miles. The route adopted
appears to have been by the Selenga to the Baikal Lake, and thence
by the Angara to the Yenisey, where the merchandise was unloaded