The Using the Twine Cookbook page of the cookbook explains how to download and import a "Live Example" HTML file. Once you have imported the file you will have a new story project which you can open, within this project are the the Passages that make up the example.
The Typewriter passage in the example includes the code that produces the "typewritter" effect.
The Start passage in the example shows how to "use" the effect.
1. Assign the text you want to display to the $typewriterText story variable.
2. Call (display: "Typewriter") to start the effect.
WARNING: This "effect" uses specific name hook as the area into which the text will be displayed and a (live:) macro to achieve the delay between the displaying of each letter of the text within that area, because of this you can only use this "effect" once per Passage.